PHPackages                             dan-rogers/workerpool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dan-rogers/workerpool

ActiveLibrary

dan-rogers/workerpool
=====================

A very basic implementation of a worker pool in PHP for shell applications

0.0.3(1y ago)72Apache-2.0PHPPHP &gt;= 5.6

Since Nov 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/DanRVP/php-workerpool)[ Packagist](https://packagist.org/packages/dan-rogers/workerpool)[ RSS](/packages/dan-rogers-workerpool/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

php-workerpool
==============

[](#php-workerpool)

A simplistic approach to a threadpool in PHP

Installation
------------

[](#installation)

```
composer require dan-rogers/workerpool

```

Example use case
----------------

[](#example-use-case)

This implementation is intended for something like the following:

- You have many accounts to process, doing things which take a long time like multiple calls to a slow external API
- Running this in sequence would take too long so you need multiple threads
- The action you are taking is run in a command line script which take arguments

Example implementation
----------------------

[](#example-implementation)

Lets use our above use case. I have 200 user accounts. For each user account I need to pull and save some from an API, process it and dispatch the processed result to another service.

Code for the above process. Lets call the script `child-process.php`:

```
