Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Event Sourcing Phpunit Laravel Package

patchlevel/event-sourcing-phpunit

A dev testing toolkit for patchlevel/event-sourcing that lets you test aggregates and subscribers with clear given/when/then notation. Dispatch commands through #[Handle] methods, assert aggregate state with closures, and use subscriber setup, run, and teardown utilities.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. This is a dev-only PHPUnit test harness for patchlevel/event-sourcing aggregates and subscribers. It has no production runtime footprint and only fits if the application already uses (or commits to) the Patchlevel event-sourcing library and its #[Handle] command/event conventions. For teams on that stack, it replaces bespoke aggregate test scaffolding with a given/when/then DSL; for teams on Spatie, EventSauce, or custom event sourcing, it is not applicable.

Integration feasibility. Technically straightforward: composer require --dev, extend the provided test case, and write aggregate tests. The real feasibility question is ecosystem validation, not mechanics. One star, zero dependents, and a single maintainer mean we would be an early adopter rather than a fast follower. The 1.0.x release line and Stryker mutation-testing badge suggest deliberate quality practices, but that is not a substitute for production usage evidence.

Technical risk.

  • Bus-factor and longevity: single-maintainer package with negligible community surface; abandonment or slow response to PHPUnit/PHP major releases is the primary risk.
  • API stability: 1.0.x implies semver intent, but a young package can still make ergonomic breaking changes; our test suite would absorb that churn.
  • Coupling to internals: the when dispatching through #[Handle] methods and subscriber setup/run/teardown utilities depend on Patchlevel’s conventions; upstream changes can break tests in non-obvious ways.
  • Compatibility matrix uncertainty: supported PHP versions, PHPUnit versions, and Patchlevel event-sourcing versions need verification; Pest compatibility is unclear.
  • Metadata anomaly: the stated last release date (2026-04-02) should be validated against Packagist before planning; treat release cadence and date accuracy as an open item.

Key questions.

  1. Which PHP, PHPUnit, and patchlevel/event-sourcing versions are supported, and is there a CI matrix?
  2. Does it support Pest, or only PHPUnit test cases?
  3. How are asynchronous subscribers, projections, and side-effect isolation handled in tests?
  4. What is the maintainer’s backward-compatibility and deprecation policy for 1.x?
  5. Can we extend assertions and base classes without forking?
  6. Is there a credible fallback if the package is abandoned—can we vendor a small internal trait?
  7. What is the security and supply-chain posture for a dev dependency with near-zero dependents?

TPM recommendation: conditional pilot, not broad adoption. Proceed only if Patchlevel event sourcing is already strategic. Budget for an internal wrapper and an exit path.

Integration Approach

Stack fit. Best fit is a Laravel/PHP codebase using PHPUnit and the Patchlevel event-sourcing library, with aggregates and subscribers already following #[Handle] conventions. If the team uses Pest, confirm compatibility first; if it uses a different event-sourcing library, stop here.

Migration path. Do not rewrite the suite. Introduce the package in one bounded context, wrap the provided test case in an internal base class (for example DomainAggregateTestCase), and migrate the highest-value aggregate tests first. Keep existing tests running in parallel until the new notation proves equivalent coverage. Treat the wrapper as the seam that isolates us from upstream API changes.

Compatibility. Pin exact versions in composer.json and commit the lockfile. Add a CI job that runs the package’s supported PHP/PHPUnit matrix, plus one job on our next planned PHPUnit major to surface upgrade friction early. Verify the Patchlevel event-sourcing version constraint before the pilot; a mismatch is a hard blocker.

Sequencing.

  1. Validate: confirm release history on Packagist, supported versions, Pest/PHPUnit stance, and license/security posture.
  2. Pilot: one aggregate and one subscriber, timeboxed, with a written comparison against current test boilerplate.
  3. Wrap: build the internal base test case and document given/when/then conventions.
  4. Expand: migrate a second bounded context; measure test readability, runtime, and maintenance effort.
  5. Decide: scale, hold at pilot, or replace with an internal harness. Revisit if community adoption or maintainer count improves.

Operational Impact

Maintenance. Runtime maintenance is near zero because it is dev-only. Test-infrastructure maintenance is not: we own version pinning, PHPUnit upgrade compatibility, and any wrapper code. Plan a quarterly dependency review and assign a named owner. The single-maintainer risk should be recorded in the dependency risk register.

Support. Expect community-grade support: documentation site, README, and issues, with no SLA. Internal ramp-up material and examples are our responsibility. Escalation options are limited to upstream issues, a fork, or replacing the harness.

Scaling. The package itself does not constrain production scaling. Test-suite scaling is the concern: mutation testing and subscriber setup/teardown can lengthen CI. Plan for parallel test execution and keep mutation testing scoped to critical aggregates rather than the whole suite.

Failure modes.

  • Upstream abandonment or delayed PHPUnit/PHP compatibility, blocking framework upgrades.
  • A breaking minor release that forces test rewrites.
  • Subscriber teardown leakage causing order-dependent or flaky tests.
  • Shallow assertions producing false confidence in aggregate behavior.
  • Coupling to Patchlevel internals that makes library upgrades disproportionately expensive.

Ramp-up. Low for developers already comfortable with given/when/then and event sourcing; moderate for those new to aggregates. A half-day workshop plus one worked example per bounded context should suffice. The main onboarding cost is teaching the internal wrapper conventions, not the package API.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel