bettergist/concurrency-helper
Composer 安装命令:
composer require bettergist/concurrency-helper
包简介
A super simple way to concurrently run many PHP instances.
README 文档
README
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
Usage
```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)]);
```
Installation
Via Composer
$ composer require phpexperts/conciseuuid
This library requires the ext-pcntl extension.
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ phpunit
Contributing
Please take a look at contributing.md if you want to make improvements.
Credits
- Theodore R. Smith
License
MIT license. Please see the license file for more information.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-07