PHPackages                             adrian-dussan/parallel-process - 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. adrian-dussan/parallel-process

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

adrian-dussan/parallel-process
==============================

run a pool of processes simultaneously

0.8.1(7y ago)05MITPHPPHP ^5.5 | ^7.0

Since Jun 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/adrian-dussan/parallel-process)[ Packagist](https://packagist.org/packages/adrian-dussan/parallel-process)[ Docs](https://github.com/graze/parallel-process)[ RSS](/packages/adrian-dussan-parallel-process/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (17)Used By (0)

Parallel Process
================

[](#parallel-process)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a29efa2614ed5ef989886c1bb63d1122a19b7b2d08d2fef80008b8c6fa757c4b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6772617a652f706172616c6c656c2d70726f636573732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graze/parallel-process)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f3fed96e69b0929ae766b60cc62412dfec19419144fbaf238f67a2ca8c5188a9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6772617a652f706172616c6c656c2d70726f636573732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/graze/parallel-process)[![Coverage Status](https://camo.githubusercontent.com/e416145e8e0591189155b6fd289989804d3cdb1022a803363d2ffec7a8a16048/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6772617a652f706172616c6c656c2d70726f636573732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graze/parallel-process/code-structure)[![Quality Score](https://camo.githubusercontent.com/a0146d8065588a2937a581f885c040e49348ba3031cc6d323c95153198415d50/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6772617a652f706172616c6c656c2d70726f636573732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graze/parallel-process)[![Total Downloads](https://camo.githubusercontent.com/3c080a12234e31363e343d49c5254fb3b5fa5f0e944ffce2aad4e331e8dc3c36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6772617a652f706172616c6c656c2d70726f636573732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graze/parallel-process)

Run multiple `Symfony\Process`'s at the same time.

![giphy](https://camo.githubusercontent.com/147b78e5dc6c445b73fd357eda5a6c3cedb942152ec23ae0269fdee35a02227d/68747470733a2f2f7374617469632e74756d626c722e636f6d2f34393066353832396437626637353439313461303165356432306465333066332f78306f6162377a2f6939526f37306a35632f74756d626c725f7374617469635f5f3634305f76322e676966)

Install
-------

[](#install)

Via Composer

```
$ composer require graze/parallel-process
```

If you want to use Tables or Lines to output to the console, include:

```
$ composer require graze/console-diff-renderer
```

Usage
-----

[](#usage)

```
$pool = new Pool();
$pool->add(new Process('sleep 100'));
$pool->add(new Process('sleep 100'));
$pool->add(new Process('sleep 100'));
$pool->add(new Process('sleep 100'));
$pool->add(new ProcessRun(new Process('sleep 100')));
$pool->run(); // blocking that will run till it finishes
```

A Pool will run all child processes at the same time.

### Priority Pool

[](#priority-pool)

A Priority pool will sort the runs to allow a prioritised list to be started. You can also limit the number of processes to run at a time.

```
$pool = new PriorityPool();
$pool->add(new Process('sleep 100'), [], 1);
$pool->add(new Process('sleep 100'), [], 0.1);
$pool->add(new Process('sleep 100'), [], 5);
$pool->add(new Process('sleep 100'), [], 10);
$pool->add(new CallbackRun(
    function () {
        return 'yarp';
    },
    [],
    2
);
$pool->run(); // blocking that will run till it finishes
```

### Recursive Pools

[](#recursive-pools)

You can add a Pool as a child to a parent pool. A Pool will act just like a standard run and hide the child runs.

If the parent is a PriorityPool, it will control all the child runs so that priorities and the max simultaneous configuration options still apply.

```
$pool = new Pool();
$pool->add(new Process('sleep 100'));
$pool2 = new Pool();
$pool2->add(new Process('sleep 100'));
$pool->add($pool2);
$pool->run(); // blocking that will run till it finishes
```

### Display

[](#display)

You can output runs in a few different ways to the command line. These require the use of the package: [`graze/console-diff-renderer`](https://github.com/graze/console-diff-renderer).

#### Table

[](#table)

Visual output of the parallel processes

```
$pool = new \Graze\ParallelProcess\PriorityPool();
for ($i = 0; $i < 5; $i++) {
    $time = $i + 5;
    $pool->add(new Process(sprintf('for i in `seq 1 %d` ; do date ; sleep 1 ; done', $time)), ['sleep' => $time]);
}
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
$table = new \Graze\ParallelProcess\Display\Table($output, $pool);
$table->run();
```

[![asciicast](https://camo.githubusercontent.com/67b1742053ca1809ebdf0143a4504a94fa2d61ee62c899ae46a340009a8cacb1/68747470733a2f2f61736369696e656d612e6f72672f612f353572307266397a696e3439733735316a3361387a626477312e706e67)](https://asciinema.org/a/55r0rf9zin49s751j3a8zbdw1)

#### Lines

[](#lines)

Write the output of each process to the screen

```
$pool = new \Graze\ParallelProcess\PriorityPool();
$pool->setMaxSimultaneous(3);
for ($i = 0; $i < 5; $i++) {
    $time = $i + 5;
    $pool->add(new Process(sprintf('for i in `seq 1 %d` ; do date ; sleep 1 ; done', $time)), ['sleep' . $time]);
}
$output = new \Symfony\Component\Console\Output\ConsoleOutput();
$lines = new \Graze\ParallelProcess\Display\Lines($output, $pool);
$lines->run();
```

[![asciicast](https://camo.githubusercontent.com/939ea9851315ca9c7d32133a98ce46b573cc419a3efb94a30f51fed9a083448c/68747470733a2f2f61736369696e656d612e6f72672f612f5a7072314a684754786d736f44584246526a7352656b3477742e706e67)](https://asciinema.org/a/Zpr1JhGTxmsoDXBFRjsRek4wt)

Testing
-------

[](#testing)

```
$ make test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Harry Bragg](https://github.com/h-bragg)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~39 days

Recently: every ~31 days

Total

13

Last Release

2791d ago

PHP version history (2 changes)0.1.0PHP ^5.5 | ^7.0

0.1.1PHP ^5.6 | ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/72cd26b253a0276bf3b7d65db8310f6e9f37413427a2401cff6740c79d2dc654?d=identicon)[adrian-dussan](/maintainers/adrian-dussan)

---

Top Contributors

[![biggianteye](https://avatars.githubusercontent.com/u/1482649?v=4)](https://github.com/biggianteye "biggianteye (3 commits)")[![adrian-dussan](https://avatars.githubusercontent.com/u/87436922?v=4)](https://github.com/adrian-dussan "adrian-dussan (2 commits)")[![peterjaap](https://avatars.githubusercontent.com/u/431360?v=4)](https://github.com/peterjaap "peterjaap (1 commits)")[![sdaoudi](https://avatars.githubusercontent.com/u/4227015?v=4)](https://github.com/sdaoudi "sdaoudi (1 commits)")[![webysther](https://avatars.githubusercontent.com/u/750007?v=4)](https://github.com/webysther "webysther (1 commits)")

---

Tags

grazeparallel-process

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/adrian-dussan-parallel-process/health.svg)

```
[![Health](https://phpackages.com/badges/adrian-dussan-parallel-process/health.svg)](https://phpackages.com/packages/adrian-dussan-parallel-process)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[phpro/soap-client

A general purpose SoapClient library

8885.6M46](/packages/phpro-soap-client)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[graze/parallel-process

run a pool of processes simultaneously

103214.3k1](/packages/graze-parallel-process)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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