PHP code example of react-parallel / infinite-pool
1. Go to this page and download the library: Download react-parallel/infinite-pool library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
react-parallel / infinite-pool example snippets
use ReactParallel\EventLoop\EventLoopBridge;
use ReactParallel\Pool\Infinite\Infinite;
$infinite = new Infinite(new EventLoopBridge(), 1);
Loop::futureTick(async(static function () use ($infinite) {
echo $infinite->run(function () {
sleep(1);
return 'Hoi!';
}), PHP_EOL;
$infinite->close();
});
use ReactParallel\EventLoop\EventLoopBridge;
use ReactParallel\EventLoop\Metrics as EventLoopMetrics;
use ReactParallel\Pool\Infinite\Infinite;
use ReactParallel\Pool\Infinite\Metrics;
use WyriHaximus\Metrics\Configuration;
use WyriHaximus\Metrics\InMemory\Registry;
$registry = new Registry(Configuration::create());
$eventLoopBridge = (new EventLoopBridge())->withMetrics(EventLoopMetrics::create($registry));
$infinite = (new Infinite($eventLoopBridge, 1.3))->withMetrics(Metrics::create($registry));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.