ConcurrencyHelper is a library for easily and efficiently running any callable via multiple parallel PHP instances.
It's aim is to substantially simplify massively parallelized operations.
Notable use cases include the Bettergist Collector project, which uses ConcurrencyHelper to massively parallize the downloads of every www.Packagist.org package, using 50-200 PHP processes.
This library requires the ext-pcntl extension.
https://github.com/bettergistco/ConcurrencyHelper
```php
$myParallelizedFunction = function (int $childNumber, array $packages, $optionalExtraParameter) {
echo "Thread $childNumber: " . implode(', ', $packages) . " of $optionalExtraParameter\n";
sleep($childNumber * 1);
echo "Finished Thread $childNumber.\n";
};
$states = [
'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado',
'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho',
];
$runner = new BettergistCollective\ConcurrencyHelper\ConcurrencyHelper();
$runner->concurrentlyRun($states, 6, $myParallelizedFunction, [count($states)]);
```
Via Composer
$ composer require phpexperts/conciseuuid
This library requires the ext-pcntl extension.
Please see the changelog for more information on what has changed recently.
$ phpunit
Please take a look at contributing.md if you want to make improvements.
- Theodore R. Smith
MIT license. Please see the license file for more information.