PHPackages                             wyrihaximus/react-child-process-pool - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. wyrihaximus/react-child-process-pool

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wyrihaximus/react-child-process-pool
====================================

Pool wyrihaximus/react-child-process-messenger processes

1.9.0(3y ago)40244.4k↓29.3%9[6 PRs](https://github.com/WyriHaximus/reactphp-child-process-pool/pulls)5MITPHPPHP ^8.0 || ^7.0 || ^5.4

Since Aug 2Pushed 8mo ago5 watchersCompare

[ Source](https://github.com/WyriHaximus/reactphp-child-process-pool)[ Packagist](https://packagist.org/packages/wyrihaximus/react-child-process-pool)[ GitHub Sponsors](https://github.com/WyriHaximus)[ RSS](/packages/wyrihaximus-react-child-process-pool/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (40)Used By (5)

Pool wyrihaximus/react-child-process-messenger processes
========================================================

[](#pool-wyrihaximusreact-child-process-messenger-processes)

[![Linux Build Status](https://camo.githubusercontent.com/1f7aa6ea878adf14209717c0ee84de236554c97bc5dffb584f3b7914b33a062b/68747470733a2f2f7472617669732d63692e6f72672f57797269486178696d75732f72656163747068702d6368696c642d70726f636573732d706f6f6c2e706e67)](https://travis-ci.org/WyriHaximus/reactphp-child-process-pool)[![Latest Stable Version](https://camo.githubusercontent.com/05201d58b4eacdcfbf8f8b8bd7815a26a3100589641ff846104982309add7646/68747470733a2f2f706f7365722e707567782e6f72672f57797269486178696d75732f72656163742d6368696c642d70726f636573732d706f6f6c2f762f737461626c652e706e67)](https://packagist.org/packages/WyriHaximus/react-child-process-pool)[![Total Downloads](https://camo.githubusercontent.com/8b1dcc2a499260d4b4eeb0da86827b054eeb3e816323655f47b41aa7ad119ca9/68747470733a2f2f706f7365722e707567782e6f72672f77797269686178696d75732f72656163742d6368696c642d70726f636573732d706f6f6c2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/wyrihaximus/react-child-process-pool)[![Code Coverage](https://camo.githubusercontent.com/7a179e3db57e8d8833f576b848309f8aec70170c6e8f469875ed652e2eb48ad9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f57797269486178696d75732f72656163747068702d6368696c642d70726f636573732d706f6f6c2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/WyriHaximus/react-child-process-pool/?branch=master)[![License](https://camo.githubusercontent.com/e96a41bcfb8f53a83fbbd399756880d6909bac85dfde6b5a5463fce13c8b5301/68747470733a2f2f706f7365722e707567782e6f72672f77797269686178696d75732f72656163742d6368696c642d70726f636573732d706f6f6c2f6c6963656e73652e706e67)](https://packagist.org/packages/wyrihaximus/react-child-process-pool)[![PHP 7 ready](https://camo.githubusercontent.com/42292c23565ea2133763d2caa68bdeb743b817613cc52c09945370667aa698e8/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f57797269486178696d75732f72656163747068702d6368696c642d70726f636573732d706f6f6c2f62616467652e737667)](https://travis-ci.org/WyriHaximus/reactphp-child-process-pool)

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

[](#installation)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `~`.

```
composer require wyrihaximus/react-child-process-pool

```

Pools
-----

[](#pools)

- `Dummy` - Meant for testing, doesn't do anything but complies to it's contract
- `Fixed` - Spawns a given fixed amount of workers
- `Flexible` - Spawns workers as a needed basis, given a minimum and maximum it will spawn within those values

Usage
-----

[](#usage)

This package pools [`wyrihaximus/react-child-process-messenger`](https://github.com/WyriHaximus/reactphp-child-process-messenger), for basic messaging please see that package for details how to use it.

Creating a pool
---------------

[](#creating-a-pool)

This package ships with a set factories, which create different pools. (All the options in the following examples are the default options.)

### Dummy

[](#dummy)

Creates a `Dummy` pool:

```
$loop = EventLoopFactory::create();

Dummy::createFromClass(ReturnChild::class, $loop)->then(function (PoolInterface $pool) {
  // Now you have a Dummy pool, which does absolutely nothing
});
```

### Fixed

[](#fixed)

Creates a `Fixed` pool:

```
$loop = EventLoopFactory::create();
$options = [
    Options::SIZE => 5,
];
Fixed::createFromClass(ReturnChild::class, $loop, $options)->then(function (PoolInterface $pool) {
    // You now have a pull with 5 always running child processes
});
```

### Flexible

[](#flexible)

Creates a `Flexible` pool:

```
$loop = EventLoopFactory::create();
$options = [
    Options::MIN_SIZE => 0,
    Options::MAX_SIZE => 5,
    Options::TTL      => 0,
];
Flexible::createFromClass(ReturnChild::class, $loop, $options)->then(function (PoolInterface $pool) {
    // You now have a pool that spawns no child processes on start.
    // But when you call rpc a new child process will be started for
    // as long as the pool has work in the queue. With a maximum of five.
});
```

### CpuCoreCountFixed

[](#cpucorecountfixed)

Creates a `Fixed` pool with size set to the number of CPU cores:

```
$loop = EventLoopFactory::create();

CpuCoreCountFlexible::createFromClass(ReturnChild::class, $loop)->then(function (PoolInterface $pool) {
    // You now have a Fixed pool with a child process assigned to each CPU core.
});
```

### CpuCoreCountFlexible

[](#cpucorecountflexible)

The following example will creates a flexible pool with max size set to the number of CPU cores. Where the `create` method requires you to give it a `React\ChildProcess\Process`. The `createFromClass` lets you pass a classname of a class implementing [`WyriHaximus\React\ChildProcess\Messenger\ChildInterface`](https://github.com/WyriHaximus/reactphp-child-process-messenger/blob/master/src/ChildInterface.php) that will be used as the worker in the client. Take a look at [`WyriHaximus\React\ChildProcess\Messenger\ReturnChild`](https://github.com/WyriHaximus/reactphp-child-process-messenger/blob/master/src/ReturnChild.php) to see how that works.

```
$loop = EventLoopFactory::create();

CpuCoreCountFlexible::createFromClass(ReturnChild::class, $loop)->then(function (PoolInterface $pool) {
    // You now have a Fixed pool with a child process assigned to each CPU core,
    // which, just like the Flexible pool, will only run when there is something
    // in the queue.
});
```

License
-------

[](#license)

Copyright 2017 [Cees-Jan Kiewiet](http://wyrihaximus.net/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Contributors beyond the commit log

[](#contributors-beyond-the-commit-log)

- Gabi Davila - Helping test if my github token will be secure for pull requests on AppVeyor

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance43

Moderate activity, may be stable

Popularity46

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~87 days

Recently: every ~365 days

Total

33

Last Release

1156d ago

PHP version history (5 changes)1.0.0-alpha1PHP &gt;=5.5.0

1.0.0-alpha9PHP ^5.4|^7.0

1.0.0-beta1PHP ^5.4||^7.0

1.5.0PHP ^7.0 || ^5.4

1.7.0PHP ^8.0 || ^7.0 || ^5.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/147145?v=4)[Cees-Jan Kiewiet](/maintainers/WyriHaximus)[@WyriHaximus](https://github.com/WyriHaximus)

---

Top Contributors

[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (377 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (17 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![bartvanhoutte](https://avatars.githubusercontent.com/u/4867154?v=4)](https://github.com/bartvanhoutte "bartvanhoutte (2 commits)")[![lucasnetau](https://avatars.githubusercontent.com/u/9331242?v=4)](https://github.com/lucasnetau "lucasnetau (2 commits)")[![gabidavila](https://avatars.githubusercontent.com/u/340055?v=4)](https://github.com/gabidavila "gabidavila (1 commits)")[![billionaire](https://avatars.githubusercontent.com/u/6255854?v=4)](https://github.com/billionaire "billionaire (1 commits)")[![tianjianjiang](https://avatars.githubusercontent.com/u/4812544?v=4)](https://github.com/tianjianjiang "tianjianjiang (1 commits)")[![Djuki](https://avatars.githubusercontent.com/u/416411?v=4)](https://github.com/Djuki "Djuki (1 commits)")

---

Tags

child-processcpu-offloadhacktoberfestphpreactphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/wyrihaximus-react-child-process-pool/health.svg)

```
[![Health](https://phpackages.com/badges/wyrihaximus-react-child-process-pool/health.svg)](https://phpackages.com/packages/wyrihaximus-react-child-process-pool)
```

###  Alternatives

[react/stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP

689126.8M194](/packages/react-stream)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34076.1M136](/packages/react-child-process)[react/zmq

ZeroMQ bindings for React.

2471.7M31](/packages/react-zmq)[wyrihaximus/react-child-process-messenger

Messenger decorator for react/child-process

32279.4k4](/packages/wyrihaximus-react-child-process-messenger)[mkraemer/react-pcntl

PCNTL bindings for ReactPHP

57289.0k9](/packages/mkraemer-react-pcntl)[thruway/client

Thruway WAMP client

11822.8k6](/packages/thruway-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
