PHPackages                             fghazaleh/multi-thread-manager - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. fghazaleh/multi-thread-manager

ActiveLibrary[Queues &amp; Workers](/categories/queues)

fghazaleh/multi-thread-manager
==============================

Multi-thread manager using Symfony process component

2.0.0(3y ago)172.6k↓50%1MITPHPPHP ^8.0

Since Apr 7Pushed 3y ago1 watchersCompare

[ Source](https://github.com/fghazaleh/multi-thread-manager)[ Packagist](https://packagist.org/packages/fghazaleh/multi-thread-manager)[ Docs](https://github.com/fghazaleh/multi-thread-manager)[ RSS](/packages/fghazaleh-multi-thread-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (7)Used By (0)

Multi Thead Manager
===================

[](#multi-thead-manager)

A Library to handle a multiple Symfony process component, by creating a command which can be handled in asynchronous (threads).

Supported PHP Versions
----------------------

[](#supported-php-versions)

- PHP 7.2
- PHP 8.0

Index
-----

[](#index)

- [Installation](#installation)
- [Usage](#usage)
    - [Create instance of `ThreadManager`](#create-instance-of-threadmanager)
    - [Add Threads](#add-threads)
    - [Wait for Threads](#wait-for-threads)
    - [Terminate Threads](#terminate-threads)
    - [Register Events/Listeners in Thread Manager](#register-eventslisteners-in-thread-manager)
- [Security Vulnerabilities](#security-vulnerabilities)
- [License](#license)

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

[](#installation)

```
$ composer require fghazaleh/multi-thread-manager

```

Usage
-----

[](#usage)

### Create instance of `ThreadManager`.

[](#create-instance-of-threadmanager)

```
$threadSize = 10;
$threadManager = \FGhazaleh\MultiThreadManager\ThreadManager::create($threadSize);
```

or

```
$threadSize = 10;
$threadStartDelay = 1; //milliseconds
$pollInterval = 120; //milliseconds
$threadManager = new \FGhazaleh\MultiThreadManager\ThreadManager(
                        new \FGhazaleh\MultiThreadManager\ThreadSettings(
                            $threadSize, $threadStartDelay, $pollInterval
                        )
                  );
```

or

```
$threadSettings = \FGhazaleh\MultiThreadManager\ThreadSettings::createFromDefault();
$threadManager = new \FGhazaleh\MultiThreadManager\ThreadManager(
                     $threadSettings
                  );
```

### Add threads

[](#add-threads)

> Add shell script command thread.

```
$threadManager->addThread('php -r "echo 123; exit(0);"');
```

> Add Symfony process thread.

```
$process = new Symfony\Component\Process\Process('php -r "echo 123; exit(0);"');
$threadManager->addThread($process);
```

> Add thread object.

```
$threadManager->addThread(
    \FGhazaleh\MultiThreadManager\Thread::createFromCommand(
        'php -r "echo 123; exit(0);"'
    )
);
```

> Add thread with context.

```
$threadManager->addThread('php -r "echo 123; exit(0);"', ['data' => 'some data']);
```

### Wait for threads

[](#wait-for-threads)

```
$threadManager->wait();
```

### Terminate threads

[](#terminate-threads)

```
$threadManager->terminate();
```

### Register Events/Listeners in Thread Manager

[](#register-eventslisteners-in-thread-manager)

> Register event with class listener.

```
$threadManager->listen(
    \FGhazaleh\MultiThreadManager\Contracts\EventInterface::EVENT_STARTED,
    new JobStartedListener()
);
$threadManager->listen(
    \FGhazaleh\MultiThreadManager\Contracts\EventInterface::EVENT_FINISHED,
    new JobFinishedListener()
);
$threadManager->listen(
    \FGhazaleh\MultiThreadManager\Contracts\EventInterface::EVENT_TIMEOUT,
    new JobTimeoutListener()
);
...
$threadManager->addThread(...)
```

> Register event closure listener function.

```
$threadManager->listen(
    \FGhazaleh\MultiThreadManager\Contracts\EventInterface::EVENT_STARTED,
    function (\FGhazaleh\MultiThreadManager\Contracts\ThreadInterface $thread){
        ...
    }
);
```

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

if you discover a security vulnerability within this boilerplate, please send an email to Franco Ghazaleh at , or create a pull request if possible. All security vulnerabilities will be promptly addressed. Please reference this page to make sure you are up to date.

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~270 days

Total

5

Last Release

1152d ago

Major Versions

0.2.0 → 2.0.02023-03-24

PHP version history (2 changes)0.0.1PHP ^7.2

2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4fb2cc76ffbd3dbe7edc1e55d544281924e9ba52601168d01fcd094f229d6a78?d=identicon)[fghazaleh](/maintainers/fghazaleh)

---

Top Contributors

[![fghazaleh](https://avatars.githubusercontent.com/u/27064820?v=4)](https://github.com/fghazaleh "fghazaleh (41 commits)")

---

Tags

asynchronousayncmultithreadingnon-blockingparallelphpprocessqueuesymfony-processthreadsasyncasynchronousnon-blockingqueueparallelthreadsmulti-processsymfony-processMulti threadAsync processmultihreading

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fghazaleh-multi-thread-manager/health.svg)

```
[![Health](https://phpackages.com/badges/fghazaleh-multi-thread-manager/health.svg)](https://phpackages.com/packages/fghazaleh-multi-thread-manager)
```

###  Alternatives

[amphp/amp

A non-blocking concurrency framework for PHP applications.

4.4k123.4M323](/packages/amphp-amp)[revolt/event-loop

Rock-solid event loop for concurrent PHP applications.

92343.6M138](/packages/revolt-event-loop)[orisai/scheduler

Cron job scheduler - with locks, parallelism and more

4037.1k4](/packages/orisai-scheduler)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[amphp/cluster

Building multi-core network applications with PHP.

6224.8k1](/packages/amphp-cluster)[aza/thread

AzaThread - Anizoptera CMF simple and powerful threads emulation component for PHP (based on forks).

7128.7k2](/packages/aza-thread)

PHPackages © 2026

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