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

v1.0.1(1mo ago)103218.9k↓55.7%23[5 issues](https://github.com/graze/parallel-process/issues)1MITPHPPHP ^7.4 || ^8.0CI passing

Since Jun 15Pushed 1mo 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 yesterday

READMEChangelog (10)Dependencies (21)Versions (25)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/9c7c2f8d098b3fc29a65f29c6218811bc55c78a37771834ff091f0c681269ae7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6772617a652f706172616c6c656c2d70726f636573732f63692e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/graze/parallel-process/actions/workflows/ci.yml)[![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

65

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 63.2% 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 ~233 days

Recently: every ~707 days

Total

15

Last Release

35d ago

Major Versions

0.8.1 → v1.0.02026-05-28

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

0.1.1PHP ^5.6 | ^7.0

v1.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![rick-lam](https://avatars.githubusercontent.com/u/114425681?v=4)](https://github.com/rick-lam "rick-lam (12 commits)")[![biggianteye](https://avatars.githubusercontent.com/u/1482649?v=4)](https://github.com/biggianteye "biggianteye (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 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.7k38.9k](/packages/matomo-matomo)[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k869.4M8.8k](/packages/symfony-http-kernel)[drupal/core

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

21866.0M1.7k](/packages/drupal-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M420](/packages/drupal-core-recommended)[civicrm/civicrm-core

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

751291.4k43](/packages/civicrm-civicrm-core)

PHPackages © 2026

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