amphp / react-adapter

Makes any ReactPHP library compatible with Amp.
https://amphp.org/react-adapter
MIT License
24 stars 5 forks source link

Using amphp packages inside react's event loop. #16

Open maciejfikus opened 1 year ago

maciejfikus commented 1 year ago

Hello there! As I am fairly new to async-php world, excuse me if this question is somehow out of place. I know that this package make it possible to use react-php components inside amphp event loop, however, I wonder if it is possible in reverse as well – I mean, tweaking this package to use amp components inside react loop? As mentioned in https://github.com/amphp/react-adapter/issues/4, there was some package to make both world compatible – unfortunately, it is no longer available, even for a reference. I would be grateful for any tips on this topic :-)

kelunik commented 1 year ago

While it might be possible to write such a reverse adapter, I don't see any need for it. The event loop implementations are pretty much equivalent, except for Amp supporting a few more features (such as unferenced watchers), which would require to be somehow emulated / worked around in an adapter the other way around.

Writing a promise adapter isn't some black magic either. I guess there might be questions if you're new to async PHP, but we're happy to help you with those.

Do you have any specific coding challenges we can help you with?