PHPackages                             rogerwaters/react-thread-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. rogerwaters/react-thread-pool

ActiveLibrary

rogerwaters/react-thread-pool
=============================

Multiprocessing library for PHP based on pcntl\_fork() and reactphp

7201PHP

Since Jun 9Pushed 9y ago2 watchersCompare

[ Source](https://github.com/RogerWaters/react-thread-pool)[ Packagist](https://packagist.org/packages/rogerwaters/react-thread-pool)[ RSS](/packages/rogerwaters-react-thread-pool/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (1)

react-thread-pool
=================

[](#react-thread-pool)

This is a multiprocessing library for PHP based on pcntl\_fork().

Status: alpha
Tests: none

Features
--------

[](#features)

- Running Parallel Processes out of a single Process
- Give the entire environment to the Thread without thinking on serialisation
- Control the thread (Start, Stop, Kill) + Custom messages
- Running tons of threads on an single ThreadPool (be careful with your processor)
- Setting up threads to observe external resources

Requirements
------------

[](#requirements)

- Linux/Unix platform
- PHP &gt;= 5.4 (also PHP 7)
- custom functions (pcntl\_fork, pcntl\_waitpid, posix\_getpid)
- [reactphp/event-loop](https://github.com/reactphp/event-loop)
- [igorw/evenement](https://github.com/igorw/evenement)
- \[optional\] PHP Extension libevent (pect/libevent-0.1.0)
- \[optional\] PHP Extension Event

Basic Usage
-----------

[](#basic-usage)

Create an EventLoop:

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

\*The loop is the same as reactphp/event-loop so you can also use this for your server
Creating a default thread to perform heavy work outside your parent process:

```
use RogerWaters\ReactThreads\EventLoop\ForkableLoopInterface;
use RogerWaters\ReactThreads\ThreadBase;

class ExampleThread extends ThreadBase
{
    protected function InitializeExternal(ForkableLoopInterface $loop)
    {
        //Do your external logic here
        //you can also use $loop functions
        //Use $this->kill(); to complete execution from child
        $this->kill();
    }
}
```

All together: ```php //create thread $thread = new ExampleThread($loop); //start thread and do external logic $thread-&gt;start(); //wait for the thread to complete $thread-&gt;on('stopped',function() use ($loop) { //thread is done //stop the parent process $loop-&gt;stop(); });

//you can do any other operations here without affecting the thread

//run the loop to wait for completion $loop-&gt;run();

```

For communicable threads see example_3.php and example_4.php

## More examples
See /examples folder

## TODO:
- Documentation
- Tests
- More examples
- https://github.com/reactphp/event-loop/issues/41
- Stability / Error handling

If you have any issues or feature request, feel free to create a ticket

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f407950dc6d5a418f6e8830486cf0c8bc7ce567cd8f6aafa8fd2239353b25afb?d=identicon)[RogerWaters](/maintainers/RogerWaters)

---

Top Contributors

[![RogerWaters](https://avatars.githubusercontent.com/u/1272565?v=4)](https://github.com/RogerWaters "RogerWaters (36 commits)")[![gcphost](https://avatars.githubusercontent.com/u/1173636?v=4)](https://github.com/gcphost "gcphost (2 commits)")

### Embed Badge

![Health badge](/badges/rogerwaters-react-thread-pool/health.svg)

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

PHPackages © 2026

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