PHPackages                             graze/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. [CLI &amp; Console](/categories/cli)
4. /
5. graze/parallel-process

ActiveLibrary[CLI &amp; Console](/categories/cli)

graze/parallel-process
======================

run a pool of processes simultaneously

0.8.1(7y ago)103214.3k↓28%23[6 issues](https://github.com/graze/parallel-process/issues)[3 PRs](https://github.com/graze/parallel-process/pulls)1MITPHPPHP ^5.5 | ^7.0CI failing

Since Jun 15Pushed 3mo ago15 watchersCompare

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

READMEChangelog (10)Dependencies (10)Versions (18)Used By (1)

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

48

—

FairBetter than 95% of packages

Maintenance52

Moderate activity, may be stable

Popularity48

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~39 days

Recently: every ~31 days

Total

13

Last Release

2792d ago

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

0.1.1PHP ^5.6 | ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/637788?v=4)[graze.com](/maintainers/graze)[@graze](https://github.com/graze)

---

Top Contributors

[![biggianteye](https://avatars.githubusercontent.com/u/1482649?v=4)](https://github.com/biggianteye "biggianteye (3 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

consoleparallelphpprocessgrazeparallel-process

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[humbug/box

Fast, zero config application bundler with PHARs.

1.3k801.5k69](/packages/humbug-box)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[n98/magerun2

Tools for managing Magento projects and installations

928244.3k6](/packages/n98-magerun2)

PHPackages © 2026

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