Event Sourcing
Event Sourcing PHP
Works with: Laravel, Symfony, and Standalone PHP
The Problem
You store the current state of your entities, but not how they got there. When a customer disputes a charge, you can't answer "what exactly happened?" Rebuilding read models after a schema change means writing migration scripts by hand. Auditors ask for a complete trail of changes and you piece it together from application logs.
How Ecotone Solves It
Ecotone provides Event Sourcing as a first-class feature. Instead of storing current state, you store the sequence of events that led to it. Rebuild any view of the data by replaying events. Get a complete, immutable audit trail automatically. Works with Postgres, MySQL, and MariaDB for event storage, with projections that can write to any storage you choose.
Building durable workflows on top of event sourcing? Event-sourced sagas (#[EventSourcingSaga]) record every state transition of a long-running process — order fulfillment, payouts, KYC, multi-step onboarding — as queryable events in your own database. Crashes, deploys, and restarts: the saga rehydrates by replaying its events and continues from exactly where it left off. See Durable Execution in PHP for the three workflow shapes Ecotone supports.
Read more in the following chapters.
Materials
Demo implementation
Links
Starting with Event Sourcing in PHP [Article]
Last updated
Was this helpful?