Skip to content

Instantly share code, notes, and snippets.

@kelunik
Last active February 23, 2018 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelunik/0daae3ea11005d03ba7a0bdc4c30b64b to your computer and use it in GitHub Desktop.
Save kelunik/0daae3ea11005d03ba7a0bdc4c30b64b to your computer and use it in GitHub Desktop.

You can use amphp/react-adapter + amphp/amp, which will give you an ev based implementation – if ev is installed – that is fully compatible with ReactPHP's LoopInterface.

$driver = (new Amp\Loop\DriverFactory)->create();
$loop = new Amp\ReactAdapter\ReactAdapter($driver);

// $loop is now a ReactPHP compatible driver based on ext-ev

If you don't want the automatic driver selection based on the available extensions, you can also instantiate a driver on your own using $driver = new Amp\Loop\EvDriver;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment