PHPackages                             parallel-php/parallel-task - 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. parallel-php/parallel-task

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

parallel-php/parallel-task
==========================

PHP parallel task multi-thread message based library

1.0.0(9y ago)52831[4 issues](https://github.com/parallel-php/parallel-task/issues)MITPHPPHP &gt;=5.5.0

Since Oct 8Pushed 7y ago2 watchersCompare

[ Source](https://github.com/parallel-php/parallel-task)[ Packagist](https://packagist.org/packages/parallel-php/parallel-task)[ RSS](/packages/parallel-php-parallel-task/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

parallel-php/parallel-task [![Build Status](https://camo.githubusercontent.com/7cc908002e1d6f1af6309807cf194c49dcd3b8292fb46cae823266ec538cc904/68747470733a2f2f7472617669732d63692e6f72672f706172616c6c656c2d7068702f706172616c6c656c2d7461736b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/parallel-php/parallel-task)
========================================================================================================================================================================================================================================================================================================================================

[](#parallel-phpparallel-task-)

Library for running parallel php tasks in a simple and intuitive way across multiple computers.

What can be done with it:

- Delegate tasks in order to improve application response time. For example, instead of sending an email inline, it can be sent asynchronously.
- Delegate tasks whose result are not required to be immediately visible or for which a response is not needed in the current script. The Examples here can range from simple things like logging up to complex application logic that can be processed with delay in order to improve high peak performance.
- Parallel processing. An algorithm that can be parallelized can benefit from this library by starting multiple workers on different machines and aggregate the results after all finished.

How to use it:

- Choose a queue implementation and create an instance of it. Existing implementations: Redis and RabbitMQ. Help with more implementations is appreciated.
- Build the worker using queue and start it in a cli environment. You can start multiple workers.

```
$workerBuilder = new ExecutorWorkerBuilder()
$worker = $workerBuilder->withConsumeQueue($queue)->buildWorker();
$worker->work($type);
```

- Build the executor using queue

```
$executorBuilder = new ExecutorWorkerBuilder()
$executor = $executorBuilder->withPublishQueue($queue)->buildExecutor();
```

- Define a task by implementing the `Task` interface.
- Submit task and get results

```
$futureResult = $executor->submit($type, MyTask::class, [$param1, $param2]);
//...some other time consuming tasks
$result = $futureResult->getResult();
```

Technically, the library is splitted into three parts:

- Queue module. Handles queue implementation details. From outside, it contains two public interfaces `PublishQueue` and `ConsumeQueue` and the input/output entities from it's methods: `InputMessage`, `InputMessageIdentifier` and `OutputMessage`.

    - `putInput` receives an `InputMessage` and store it for processing

    - `submitInput` receives an `InputMessage`, store it for processing and returns and `InputMessageIdentifier` for fetching the result.
    - `getOutput` receives an `InputMessageIdentifier` and returns the `OutputMessage` result for it. It's blocking until the result is available.
    - `run` receives a callable. It should fetch an `InputMessage`, run to callable with it as an input and stores the received `Output`.
- Task module. Uses Queue module adding a layer of `Task` implementation. From the outside, it has two classes with two interfaces: `TaskScheduler` and `TaskRunner` each of them used for scheduling a task for asynchronous run and respectively running tasks asynchronously.

    The interfaces of `TaskScheduler` is:

    - `execute` receives a new Task and the inputs for it. It should be used for methods that don't have a return type.

    - `submit` receives a new Task and the inputs for it and returns a `FutureTaskResult`. Should be used for methods that returns something.

    The interfaces of `TaskRunner` is:

    - `run` runs tasks asynchronously in a loop

    - `runOnce` runs only one task asynchronously
- Executor/Worker facade. It is just a wrapper around Task module to allow easier composition and usage.

    There is a builder that helps creating `Executor` or `Worker` allowing to configure implementation for `PublishQueue` and `ConsumeQueue` and to change default implementation of `TaskInputMessageTransformer`, `TaskFactory`, `TaskResultMessageTransformer` and `TaskRunnerSupervisor`.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance4

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3508d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8714fa223d32c91d96ba5aededaea9dba9b395eb7574732e5964c280d2b5efaf?d=identicon)[drealecs](/maintainers/drealecs)

---

Top Contributors

[![drealecs](https://avatars.githubusercontent.com/u/209984?v=4)](https://github.com/drealecs "drealecs (90 commits)")

---

Tags

asynchronousparalleltaskworkerthreadsThreadMulti threadparallel-task

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/parallel-php-parallel-task/health.svg)

```
[![Health](https://phpackages.com/badges/parallel-php-parallel-task/health.svg)](https://phpackages.com/packages/parallel-php-parallel-task)
```

###  Alternatives

[qxsch/worker-pool

Runs tasks in a parallel processing workerpool.

108325.7k1](/packages/qxsch-worker-pool)[recoil/recoil

Asynchronous coroutines for PHP 7.

78961.5k7](/packages/recoil-recoil)[jolicode/castor

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

53541.0k3](/packages/jolicode-castor)[aza/thread

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

7128.7k2](/packages/aza-thread)[orisai/scheduler

Cron job scheduler - with locks, parallelism and more

4037.1k4](/packages/orisai-scheduler)[fghazaleh/multi-thread-manager

Multi-thread manager using Symfony process component

172.6k](/packages/fghazaleh-multi-thread-manager)

PHPackages © 2026

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