patchlevel/laravel-event-sourcing
Laravel event sourcing with aggregates, projectors, reactors, snapshots, and a database-backed event store. Includes artisan tooling, testing helpers, and a clean API for modeling domain events in Laravel applications.
As of 1.5.0, start by installing the package with Composer and reading the docs at patchlevel.dev — the project moved docs from mkdocs to that site in this release. Publish any package config and migrations, then configure your event store connection.
The quickest first use case is a small aggregate + projector flow:
If you are on a standard Laravel database stack, evaluate the new Illuminate-based store implementations first; they reduce the need for custom store wiring. Leave metadata caching and custom hydration off until the basic write/project/replay loop works.
1.5.0 release adds Illuminate-based store implementations, so teams using MySQL/PostgreSQL/SQLite can often use native Laravel connections and migrations instead of maintaining a custom store adapter.1.5.0 adds metadata cache support and adapts to hashed metadata cache keys. Enable it when metadata lookups are repeated often, but treat the cache as an implementation detail rather than something to inspect or manipulate directly.StackHydrator for payload evolution. If event payloads need versioning, custom serialization, or compatibility handling, compose hydrators in the intended order and add extensions deliberately. Cover old and new event shapes in replay tests.1.5.0 switches to hashed metadata cache keys. Use the package APIs and clear the metadata cache after upgrading or changing metadata serialization/config.StackHydrator and extensions, register hydrators in the documented order and add tests for historical events. A hydrator change can break replay even when new writes work.1.5.0 as a minor upgrade, but still verify. The release is feature-focused and does not list breaking changes. Run the full event write/project/replay path and clear caches before shipping.How can I help you explore Laravel packages today?