PHP code example of andersondanilo / process-pool
1. Go to this page and download the library: Download andersondanilo/process-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/ */
andersondanilo / process-pool example snippets
use ProcessPool\ProcessPool;
use Symfony\Component\Process\Process;
function processGenerator($count) {
for ($i = 0; $i < 10; $i++) {
yield new Process(['sleep', $i]);
}
}
$processes = processGenerator(10);
$pool = new ProcessPool($processes);
$pool->setConcurrency(2);
$pool->wait();