PHPackages                             peridot-php/peridot-concurrency - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. peridot-php/peridot-concurrency

ActiveLibrary[Testing &amp; Quality](/categories/testing)

peridot-php/peridot-concurrency
===============================

Concurrent spec runner for the peridot bdd framework

1.1.0(11y ago)1237.7k1[1 issues](https://github.com/peridot-php/peridot-concurrency/issues)2MITPHP

Since Feb 15Pushed 11y ago2 watchersCompare

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

READMEChangelogDependencies (6)Versions (3)Used By (2)

peridot-concurrency
===================

[](#peridot-concurrency)

Lets run our specs a lot faster!

[![Build Status](https://camo.githubusercontent.com/863e848bebf5cfc605bbf99e2eb17b4bd14c79b0944d1aa20ad6a500cb25e3c4/68747470733a2f2f7472617669732d63692e6f72672f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792e706e67)](https://travis-ci.org/peridot-php/peridot-concurrency) [![HHVM Status](https://camo.githubusercontent.com/0f376145b38cf5a8a47178e2bcb5f6f1fdb2794f744a0c346bac02e6fb48280c/687474703a2f2f6868766d2e683463632e64652f62616467652f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792e737667)](http://hhvm.h4cc.de/package/peridot-php/peridot-concurrency)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1d239e5cd9065e8b00c2ad637dc1cbf5dc0532c15a8e77a45c7fc8f98311a87a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/peridot-php/peridot-concurrency/?branch=master) [![Coverage Status](https://camo.githubusercontent.com/bcd794b67505848f346e6115575014e705511ca5733a3cd30eb65b526115f138/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/peridot-php/peridot-concurrency?branch=master)

This plugin includes a runner and reporter that allows you to run your Peridot tests concurrently! Have a bunch of slow WebDriver tests? How about a bunch of DB tests? Tired of waiting? Why not run them at the same time!?!?

How does it work?
-----------------

[](#how-does-it-work)

peridot-concurrency leverages good old fashioned non-blocking IO to run our tests concurrently. This plugin creates `N` worker processes as specified on the command line, and each worker communicates with the main process as test results become available. The function responsible for polling workers is the [stream\_select](http://php.net/manual/en/function.stream-select.php) function.

Usage
-----

[](#usage)

You can install via composer:

```
composer require --dev peridot-php/peridot-concurrency

```

peridot-concurreny can be added to your test workflow like any Peridot extension - that is via the `peridot.php` file:

```
use Evenement\EventEmitterInterface;
use Peridot\Concurrency\ConcurrencyPlugin;

return function (EventEmitterInterface $emitter) {
    $concurrency = new ConcurrencyPlugin($emitter);
};
```

After registering the plugin, your usage screen should have a couple of new options:

[![Peridot concurrency usage](https://camo.githubusercontent.com/22f1d9aa86d2eb20c296fdf2e338949ae63956f20e13059c18cdbdb3bf62744f/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6d61737465722f75736167652e706e67 "Peridot concurrency usage")](https://camo.githubusercontent.com/22f1d9aa86d2eb20c296fdf2e338949ae63956f20e13059c18cdbdb3bf62744f/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6d61737465722f75736167652e706e67)

### --concurrent

[](#--concurrent)

This is how you signal Peridot to run your tests concurrently. This will start as many worker processes as specified by the new `-p` option (defaulting to 5). In addition to starting workers, this will override the Peridot reporter to use the `ConcurrentReporter` provided by this plugin. This reporter prevents output from being garbled, and offers useful information like the time it takes each suite file to run.

### --processes (-p)

[](#--processes--p)

This new option can be used to specify the number of worker processes to start. It defaults to 5, and the sweet spot will vary from machine to machine.

OS Support
----------

[](#os-support)

Due to limitations of the Windows operating system, it is currently not supported by the peridot-concurreny plugin. This has to do with the `stream_select` function not being able to work with file descriptors returned from `proc_open` on the Windows operating system.

`stream_select` is currently the most efficient "out-of-the-box" solution for this type of work, but stay tuned for a "process per test" runner that works on Windows, and a [pthreads](http://php.net/manual/en/book.pthreads.php) based runner where the extension is available.

Performance
-----------

[](#performance)

There is some overhead with creating processes, so not every suite will improve from using concurrency. For example, if you have a suite that runs in 68ms, it's hard to improve on that. BUT! The test suites run so far, have noticed significant speed improvements, even on the unit level.

peridot-concurrency runs it's own tests concurrently:

### before

[](#before)

[![Peridot concurrency suite run serially](https://camo.githubusercontent.com/7bdfc7435ca494481e02053325418e393f1a2d03245c177d5f219cd89c3b991e/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6d61737465722f646f742e706e67 "Peridot concurrency suite run serially")](https://camo.githubusercontent.com/7bdfc7435ca494481e02053325418e393f1a2d03245c177d5f219cd89c3b991e/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6d61737465722f646f742e706e67)

### after

[](#after)

[![Peridot concurrency suite run concurrently](https://camo.githubusercontent.com/30184fca73737d2ad3d7fe6e7af435d2887984fb2caf98fd2341fb9560d48962/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6d61737465722f636f6e63757272656e742e706e67 "Peridot concurrency suite run concurrently")](https://camo.githubusercontent.com/30184fca73737d2ad3d7fe6e7af435d2887984fb2caf98fd2341fb9560d48962/68747470733a2f2f7261772e6769746875622e636f6d2f70657269646f742d7068702f70657269646f742d636f6e63757272656e63792f6d61737465722f636f6e63757272656e742e706e67)

On the machines tested, Peridot's own test suite was run in 1/4th of the time! You can see peridot-concurrency's [travis build](https://travis-ci.org/peridot-php/peridot-concurrency) to see even faster run times.

The thing to note here is that these are just unit test suites. The amount of time saved running a bulky integration or functional test suite would be even more significant (examples coming soon).

### Fine tuning

[](#fine-tuning)

As mentioned before, the exact number of processes to use will vary from machine to machine. Try experimenting with different process numbers to get the most speed out of peridot-concurrency.

Test Tokens
-----------

[](#test-tokens)

Each worker process has its own unique ID, and it is surfaced as an environment variable `PERIDOT_TEST_TOKEN`. This may be useful for creating unique resources based on this token. For instance:

```
$id = getenv('PERIDOT_TEST_TOKEN');
$dbname = "mydb_$id";
//create and seed DB identified by $dbname
//do database things
```

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

[](#contributing)

Concurrency can be tricky business. If you have any issues or ideas please let us know! Pull requests are always welcome.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

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

Total

2

Last Release

4101d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71e23eec19a24f64f37c622e76e725c9a580f83ff40c411da9bad97e0a49089?d=identicon)[brianium](/maintainers/brianium)

---

Top Contributors

[![brianium](https://avatars.githubusercontent.com/u/636651?v=4)](https://github.com/brianium "brianium (151 commits)")

### Embed Badge

![Health badge](/badges/peridot-php-peridot-concurrency/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[instaclick/php-webdriver

PHP WebDriver for Selenium 2

43661.8M22](/packages/instaclick-php-webdriver)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69617.9M510](/packages/spatie-phpunit-snapshot-assertions)[szepeviktor/phpstan-wordpress

WordPress extensions for PHPStan

3287.8M898](/packages/szepeviktor-phpstan-wordpress)[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14327.7M294](/packages/dms-phpunit-arraysubset-asserts)

PHPackages © 2026

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