vanio/doctrine-domain-events
A Doctrine ORM integration that lets your entities record and dispatch domain events. Collect events during persistence, then release them after flush via a configurable dispatcher, keeping your domain model decoupled from infrastructure.
flush), this package makes Doctrine's flush the publishing boundary. That's a defensible product/architecture decision worth evaluating on its merits, independent of the package's popularity.flush from inside an event triggered by flush (re-entrant/nested flush) — maps directly to a real product behavior class: "when an aggregate changes, another aggregate must also change, atomically." Examples: order placed → inventory reservation → stock ledger entry; invoice issued → ledger posting; user onboarded → default workspace/project created. Without this, teams either duplicate flush logic in application services or accept eventual consistency where they wanted a transaction.Adopt (or fork) when:
laravel-doctrine/doctrine/orm alongside Eloquent. If you are Laravel-native with Eloquent only, this package is not applicable; the equivalent decision is spatie/laravel-event-sourcing or a hand-rolled model-event dispatcher.Look elsewhere — do not adopt — when:
symfony/messenger with DispatchAfterCurrentBusStamp cover this with far less risk.Verdict for the roadmap: evaluate, don't adopt. Timebox a 3–5 day spike against a real cross-aggregate workflow, and plan to vendor/fork the event-collection mechanics into an internal package that you control, with the nested-flush behavior explicitly documented as your own contract.
For executives — one paragraph: "This is a small, MIT-licensed library that lets our domain objects announce 'something happened' without knowing who cares, and lets those reactions participate in the same database transaction — including cascading writes that today require duplicated code in multiple places. It's not a strategy; it's a plumbing decision. The library itself is immature (six GitHub stars, no downstream users, effectively one maintainer), so the recommendation is not to take a dependency on it. The recommendation is to use it as a blueprint and spend a few days validating the pattern against one real workflow. Expected benefit: less duplicated orchestration code, cleaner module boundaries, and a credible path toward splitting the monolith later. Expected cost: roughly one engineer-week, with the option to stop after the spike."
For engineering:
postFlush hook that drains per-entity recorded events into a dispatcher, plus re-entrant flush support so a listener can persist further changes without recursion or transaction corruption.How can I help you explore Laravel packages today?