andytruong / php-pool
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Installs: 137
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/andytruong/php-pool
Requires
- ext-pcntl: *
This package is auto-updated.
Last update: 2023-02-09 10:47:22 UTC
README
Run tasks in parallel with limited threads.
Example usage:
<?php $pool = new andytruong\pool\Pool($poolSize = 3); $tasks = [1, 2, 3, 4, 5]; foreach ($tasks as $task) { $pool->execute( function($task) { echo "[callback] processing {$task}" . PHP_EOL; sleep(5); # slow task process echo "[callback] completed {$task}" . PHP_EOL; }, [$task] ); } $pool->wait();
Install
composer require andytruong/php-pool