Download the PHP package werkint/reactphp-event-loop without Composer
On this page you can find all versions of the php package werkint/reactphp-event-loop. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download werkint/reactphp-event-loop
More information about werkint/reactphp-event-loop
Files in werkint/reactphp-event-loop
Package reactphp-event-loop
Short Description Event loop abstraction layer that libraries can use for evented I/O.
License MIT
Informations about the package reactphp-event-loop
EventLoop Component
Event loop abstraction layer that libraries can use for evented I/O.
In order for async based libraries to be interoperable, they need to use the
same event loop. This component provides a common LoopInterface
that any
library can target. This allows them to be used in the same loop, with one
single run
call that is controlled by the user.
In addition to the interface there are some implementations provided:
-
StreamSelectLoop
: This is the only implementation which works out of the box with PHP. It does a simpleselect
system call. It's not the most performant of loops, but still does the job quite well. -
LibEventLoop
: This uses thelibevent
pecl extension.libevent
itself supports a number of system-specific backends (epoll, kqueue). -
LibEvLoop
: This uses thelibev
pecl extension (github). It supports the same backends as libevent. ExtEventLoop
: This uses theevent
pecl extension. It supports the same backends as libevent.
All of the loops support these features:
- File descriptor polling
- One-off timers
- Periodic timers
- Deferred execution of callbacks
Usage
Here is an async HTTP server built with just the event loop.
Note: The factory is just for convenience. It tries to pick the best
available implementation. Libraries SHOULD
allow the user to inject an
instance of the loop. They MAY
use the factory when the user did not supply
a loop.