bronsted / fiberloop
Fiberloop
Requires
- php: ^8.1
Requires (Dev)
- phpunit/phpunit: ^9.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
This package implements coroutines by utilizing php fibers. It does the same job a Revolt but implementation is different. It has the same interface as Revolt and I have expanded it a bit.
On top of this I have build Psr-Http which is a PSR complaint Http web server and a client.
Using coroutines enables you to write code which handles multiple tasks in php single threaded execution model. This makes your program efficient and can handle more work.
Installation
This package can be installed with Composer
`composer install bronsted\fiberloop`
Usage
The loop waits for stream readiness or the next timer deadline when no fibers are runnable. Waiting for one stream does not block other watchers or timers. Callbacks should still avoid blocking I/O and other blocking operations.
The optional timeout on readable watchers is a maximum polling interval in microseconds,
not an inactivity timeout. A value of 0 waits for readiness; other scheduled work can
still wake the loop.
Development
Containers started by the make targets have the bronsted.fiberloop label. make clean
only removes exited or created containers with that label; running containers and
unlabelled containers are left untouched.