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 Phpstan Extension Laravel Package

patchlevel/event-sourcing-phpstan-extension

PHPStan extension for patchlevel/event-sourcing that validates aggregates before runtime: flags uninitialized and unused properties, write-only state, event recording inside apply methods, and state changes outside apply.

View on GitHub
Deep Wiki
Context7

Latest Stable Version License

event-sourcing-phpstan-extension

"PHPStan that understands your aggregates and catches event sourcing mistakes before runtime."

Features

  • Property initialization for aggregate roots and child aggregates, so PHPStan does not report false uninitialized property errors.
  • Unused properties are reported when no apply method writes them, because such a property can never receive state from an event.
  • Write only properties are reported when apply methods store state that is never read, because state that is not used to check invariants belongs in a projection.
  • Recording in apply methods is reported as an error, because recording events while replaying them leads to duplicated events.
  • Writing state outside apply methods is reported as an error, because state that is not derived from an event is lost when the aggregate is reloaded.

Installation

composer require --dev patchlevel/event-sourcing-phpstan-extension

If you use phpstan/extension-installer, the extension is registered automatically. Otherwise register it in your phpstan.neon:

includes:
    - vendor/patchlevel/event-sourcing-phpstan-extension/extension.neon

Documentation

Integration

Contributing

We are open to contributions as long as they are in line with our BC-Policy.

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.

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.
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
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style