PHPackages                             innmind/black-box - 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. innmind/black-box

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

innmind/black-box
=================

Test library

7.0.0(1mo ago)44193.7k↓33%3[2 issues](https://github.com/Innmind/BlackBox/issues)20MITPHPPHP ~8.4CI passing

Since Sep 29Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Innmind/BlackBox)[ Packagist](https://packagist.org/packages/innmind/black-box)[ Docs](http://github.com/Innmind/BlackBox)[ RSS](/packages/innmind-black-box/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (21)Versions (91)Used By (20)

BlackBox
========

[](#blackbox)

[![CI](https://github.com/Innmind/BlackBox/actions/workflows/ci.yml/badge.svg)](https://github.com/Innmind/BlackBox/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/1ffaef5047b9d3c2c19016d9dfee55a3fb3d352ba1b0d21a5d1152814dbc8dd1/68747470733a2f2f636f6465636f762e696f2f67682f496e6e6d696e642f426c61636b426f782f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/Innmind/BlackBox)[![Type Coverage](https://camo.githubusercontent.com/493b25380c946e2aec0b2a21114c355aa8ac1b7934feb3df37f6e2fdd3f497d4/68747470733a2f2f73686570686572642e6465762f6769746875622f496e6e6d696e642f426c61636b426f782f636f7665726167652e737667)](https://shepherd.dev/github/Innmind/BlackBox)

BlackBox is a Property Based Testing framework and test runner.

Property Based Testing is a way to verify a piece of code always behave the same way (aka a Property) by testing it with multiple values of a given type.

The common introduction to this approach is the `add` function that has 3 properties:

- it is commutative
- it is associative
- it is an identity function

To prove this via BlackBox you can do it this way:

```
use Innmind\BlackBox\{
    Application,
    Set,
    Runner\Assert,
    Prove,
};

Application::new([])
    ->tryToProve(static function(Prove $prove) {
        yield $prove
            ->proof('add is commutative')
            ->given(
                Set::integers(),
                Set::integers(),
            )
            ->test(static fn(Assert $assert, int $a, int $b) => $assert->same(
                add($a, $b),
                add($b, $a),
            ));

        yield $prove
            ->proof('add is associative')
            ->given(
                Set::integers(),
                Set::integers(),
                Set::integers(),
            )
            ->test(static fn(Assert $assert, int $a, int $b, int $c) => $assert->same(
                add(add($a, $b), $c),
                add($a, add($b, $c)),
            ));

        yield $prove
            ->proof('add is an identity function')
            ->given(Set::integers())
            ->test(static fn(Assert $assert, int $a) => $assert->same(
                $a,
                add($a, 0),
            ));
    })
    ->exit();
```

By default BlackBox will generate 100 scenarii for each proof.

[![](add.png)](add.png)

Note

BlackBox use the term *proof* to emphasize that you are testing behaviours not specific scenarii, but these are NOT [formal proofs](https://en.wikipedia.org/wiki/Formal_proof)

Installation
------------

[](#installation)

```
composer require --dev innmind/black-box
```

Documentation
-------------

[](#documentation)

Full documentation can be found in the [here](https://innmind.org/BlackBox/).

###  Health Score

68

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity45

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.6% 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 ~29 days

Recently: every ~23 days

Total

83

Last Release

50d ago

Major Versions

2.9.0 → 3.0.02019-11-30

3.0.0 → 4.0.02020-01-05

4.18.1 → 5.0.02023-05-29

5.10.1 → 6.0.02025-03-12

v6.x-dev → 7.0.02026-05-14

PHP version history (5 changes)1.0.0PHP ~7.2

3.0.0PHP ~7.4

4.14.0PHP ~7.4|~8.0

5.0.0PHP ~8.2

7.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (1072 commits)")[![casahugo](https://avatars.githubusercontent.com/u/8735848?v=4)](https://github.com/casahugo "casahugo (1 commits)")[![jdecool](https://avatars.githubusercontent.com/u/433926?v=4)](https://github.com/jdecool "jdecool (1 commits)")[![leNEKO](https://avatars.githubusercontent.com/u/55792?v=4)](https://github.com/leNEKO "leNEKO (1 commits)")[![ngdo-pro](https://avatars.githubusercontent.com/u/22030946?v=4)](https://github.com/ngdo-pro "ngdo-pro (1 commits)")

---

Tags

testfixturesproperty based testing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/innmind-black-box/health.svg)

```
[![Health](https://phpackages.com/badges/innmind-black-box/health.svg)](https://phpackages.com/packages/innmind-black-box)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k136.1M985](/packages/brianium-paratest)[phpunit/phpunit

The PHP Unit Testing framework.

20.0k955.1M155.1k](/packages/phpunit-phpunit)[pestphp/pest

The elegant PHP Testing Framework.

11.6k72.2M20.5k](/packages/pestphp-pest)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M344](/packages/drupal-core-dev)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1499.9M107](/packages/ergebnis-phpunit-slow-test-detector)[dvdoug/behat-code-coverage

Generate Code Coverage reports for Behat tests

623.9M54](/packages/dvdoug-behat-code-coverage)

PHPackages © 2026

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