ddd-module/broadway
Broadway provides infrastructure and testing helpers for building CQRS and event-sourced PHP applications. It offers loosely coupled components for command handling, event storage, and projection workflows, designed to stay out of your way and be used together or separately.
EventStore, CommandBus, ReadModel) are modular, allowing selective adoption (e.g., use EventStore without full ES).broadway/event-store-dbal), MongoDB, and in-memory stores. Laravel’s Eloquent or Query Builder can integrate with DBAL.nWidart/Laravel-broadway.HandleCommandMiddleware).Route::post('/orders', OrderCommandHandler::class)).broadway/event-store-dbal with Laravel’s database connection.ProjectReadModelJob).Order) with:
CreateOrderCommand).broadway/broadway and nwidart/laravel-broadway.broadway/event-store-dbal, broadway/read-model-elasticsearch, etc., separately.CommandLogger) for command success/failure tracking.EventStoreTest helpers).EventDispatchingCommandBus to integrate with Laravel’s exception handling.Processor component can handle parallel command processing.| Component | Failure Mode | Mitigation |
|---|---|---|
| Event Store | Data corruption (e.g., duplicate events) | Use idempotent commands and playhead checks. |
| Read Models | Projection lag or failures | Implement compensation transactions and alerts. |
| Command Bus | Command timeouts or deadlocks | Use circuit breakers and queue monitoring. |
| Aggregate Loading | Stale state due to incomplete event replay | Use snapshotting for large aggregates. |
| Testing | Flaky scenario tests | Isolate tests with in-memory event stores. |
How can I help you explore Laravel packages today?