Audit Trail & State Rebuild
How to implement Event Sourcing for audit trails and state rebuilds in PHP
The Problem You Recognize
What the Industry Calls It
How Ecotone Solves It
#[EventSourcingAggregate]
class Order
{
#[Identifier]
private string $orderId;
#[CommandHandler]
public static function place(PlaceOrder $command): array
{
return [new OrderWasPlaced($command->orderId, $command->items)];
}
#[EventSourcingHandler]
public function onOrderPlaced(OrderWasPlaced $event): void
{
$this->orderId = $event->orderId;
}
}Next Steps
Last updated
Was this helpful?