PHPackages                             patchlevel/event-sourcing-phpunit - 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. patchlevel/event-sourcing-phpunit

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

patchlevel/event-sourcing-phpunit
=================================

Test your event-sourcing aggregates and subscribers with a clear given / when / then notation

1.7.0(3mo ago)1112.6k↓55%2[1 issues](https://github.com/patchlevel/event-sourcing-phpunit/issues)[3 PRs](https://github.com/patchlevel/event-sourcing-phpunit/pulls)MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Feb 12Pushed 6d ago2 watchersCompare

[ Source](https://github.com/patchlevel/event-sourcing-phpunit)[ Packagist](https://packagist.org/packages/patchlevel/event-sourcing-phpunit)[ Docs](https://event-sourcing.patchlevel.io)[ RSS](/packages/patchlevel-event-sourcing-phpunit/feed)WikiDiscussions 1.8.x Synced 2d ago

READMEChangelog (9)Dependencies (10)Versions (23)Used By (0)

[![Mutation testing badge](https://camo.githubusercontent.com/30e14120b7357a81d5f11a5e56f67a5478c3f1278f90cc7549e32f5e42038f45/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324670617463686c6576656c2532466576656e742d736f757263696e672d706870756e6974253246312e302e78)](https://dashboard.stryker-mutator.io/reports/github.com/patchlevel/event-sourcing-phpunit/1.0.x)[![Latest Stable Version](https://camo.githubusercontent.com/9c094fdd83811b6131a08e0e8f01641ab6e27089c89bf4485f586ebae9c79412/68747470733a2f2f706f7365722e707567782e6f72672f70617463686c6576656c2f6576656e742d736f757263696e672d706870756e69742f76)](//packagist.org/packages/patchlevel/event-sourcing-phpunit)[![License](https://camo.githubusercontent.com/43e6d6aae2b134d7145ef807299a6ad09e58c95a19cc9701ccd4e5a85303d75e/68747470733a2f2f706f7365722e707567782e6f72672f70617463686c6576656c2f6576656e742d736f757263696e672d706870756e69742f6c6963656e7365)](//packagist.org/packages/patchlevel/event-sourcing-phpunit)

Event Sourcing PHPUnit
======================

[](#event-sourcing-phpunit)

"Test your event-sourcing aggregates and subscribers with a clear given / when / then notation."

Features
--------

[](#features)

- A [given / when / then test case](https://patchlevel.dev/docs/event-sourcing-phpunit/latest/testing-aggregates) for aggregate behaviour
- A `when` that also [dispatches commands](https://patchlevel.dev/docs/event-sourcing-phpunit/latest/testing-aggregates) through your `#[Handle]` methods
- [Aggregate state assertions](https://patchlevel.dev/docs/event-sourcing-phpunit/latest/testing-aggregates) with closures
- A [subscriber utility](https://patchlevel.dev/docs/event-sourcing-phpunit/latest/testing-subscribers) for setup, run and teardown
- and much more...

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

[](#installation)

```
composer require --dev patchlevel/event-sourcing-phpunit
```

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

[](#documentation)

- Latest [Docs](https://patchlevel.dev/docs/event-sourcing-phpunit/latest)
- Related [Blog](https://patchlevel.dev/blog)

Integration
-----------

[](#integration)

- [event-sourcing](https://github.com/patchlevel/event-sourcing)

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

[](#contributing)

We are open to contributions as long as they are in line with our [BC-Policy](https://patchlevel.dev/our-backward-compatibility-promise).

Also note that the `composer.lock` is always generated with the newest supported PHP version as this is the version our tools run in the CI.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance72

Regular maintenance activity

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 79.5% 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 ~28 days

Total

18

Last Release

17d ago

PHP version history (4 changes)1.0.0PHP ~8.1.0 || ~8.2.0 || ~8.3.0

1.1.0PHP ~8.2.0 || ~8.3.0

1.2.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0

1.3.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/470138?v=4)[David Badura](/maintainers/DavidBadura)[@DavidBadura](https://github.com/DavidBadura)

![](https://avatars.githubusercontent.com/u/2017762?v=4)[Daniel Badura](/maintainers/DanielBadura)[@DanielBadura](https://github.com/DanielBadura)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (167 commits)")[![DanielBadura](https://avatars.githubusercontent.com/u/2017762?v=4)](https://github.com/DanielBadura "DanielBadura (34 commits)")[![wikando-ck](https://avatars.githubusercontent.com/u/73299324?v=4)](https://github.com/wikando-ck "wikando-ck (6 commits)")[![DavidBadura](https://avatars.githubusercontent.com/u/470138?v=4)](https://github.com/DavidBadura "DavidBadura (2 commits)")[![fritz-gerneth](https://avatars.githubusercontent.com/u/1294731?v=4)](https://github.com/fritz-gerneth "fritz-gerneth (1 commits)")

---

Tags

testingphpunitdddevent sourcing

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/patchlevel-event-sourcing-phpunit/health.svg)

```
[![Health](https://phpackages.com/badges/patchlevel-event-sourcing-phpunit/health.svg)](https://phpackages.com/packages/patchlevel-event-sourcing-phpunit)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k136.1M986](/packages/brianium-paratest)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k42.5M40.9k](/packages/orchestra-testbench)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69619.8M639](/packages/spatie-phpunit-snapshot-assertions)[yoast/phpunit-polyfills

Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

18543.6M1.3k](/packages/yoast-phpunit-polyfills)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10958.3M21](/packages/ta-tikoma-phpunit-architecture-test)[allure-framework/allure-phpunit

Allure PHPUnit integration

6913.4M46](/packages/allure-framework-allure-phpunit)

PHPackages © 2026

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