Driver
Flow embark multiple drivers.
Coroutine#
Drivers are useful to essentially provide asynchronous programming by using coroutines.
Thus, this can be implemented in severals ways in most popular programming languages.
Coroutine are very similar to threads and provide concurrency but not parallelism.
Advantage of using coroutine :
- this can be a preferred usage to thread for hard-realtime context.
- there is no need for synchronisation primitives such as mutexes, semaphore.
- it reduces the usage of system lock for sharing resources.
Amp Driver#
To use Amp Driver, you have to require the library with composer
composer require amphp/amp
More documentation can be found https://amphp.org
Fiber Driver#
More documentation can be found https://www.php.net/manual/fr/language.fibers.php
ReactPHP Driver#
To use ReactPHP Driver, you have to require the library with composer
composer require react/async
More documentation can be found https://reactphp.org
Spatie Driver#
To use Spatie Driver, you have to require the library with composer
composer require spatie/async
More documentation can be found https://github.com/spatie/async
Swoole Driver#
To use Swoole Driver, you have to add the extension with your current running PHP
pecl install openswoole-22.0.0
-
More documentation can be found https://openswoole.com
Make your custom driver#
You can make your custom driver by implementing Flow\DriverInterface
Edit this page on GitHub