Skip to Content
Mastering PHP 7
book

Mastering PHP 7

by Branko Ajzele
June 2017
Intermediate to advanced
536 pages
9h 49m
English
Packt Publishing
Content preview from Mastering PHP 7

React event loop

Without any of the suggested event loop extensions, React event loop defaults to the React\EventLoop\StreamSelectLoop class, which is a stream_select() function-based event loop.

The page at http://php.net/manual/en/function.stream-select.php states, The stream_select() function accepts arrays of streams and waits for them to change status 

As we already saw in our previous examples, making an event loop in React is simple

<?phprequire_once __DIR__ . '/vendor/autoload.php';use \React\EventLoop\Factory;use \Rx\Scheduler;$loop = Factory::create();Scheduler::setDefaultFactory(function () use ($loop) {    return new Scheduler\EventLoopScheduler($loop);});// Within the loop$loop->run();

We are using the Factory::create() static ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning PHP 7

Learning PHP 7

Antonio L Zapata (GBP)
Upgrading to PHP 5

Upgrading to PHP 5

Adam Trachtenberg

Publisher Resources

ISBN: 9781785882814Supplemental Content