- What is household/broadway used for in Laravel?
- household/broadway is a Laravel integration layer for Broadway, the PHP CQRS and event sourcing library. It helps wire command buses, event buses, aggregates, projections, and read-model infrastructure into a Laravel application. Use it when you want to separate write-side domain logic from read models using events.
- How do I install household/broadway?
- Install it with Composer using composer require household/broadway. Laravel package auto-discovery should register the service provider; if not, add the provider to your config/app.php providers array. Check the package README for any publishable configuration or migrations.
- Which Laravel versions does household/broadway support?
- The supported Laravel versions are defined in the package composer.json, so check its illuminate/support and php constraints before installing. Because this is a Broadway integration, you should also verify compatibility with your Broadway version and event store. Run composer why-not household/broadway if Composer reports a conflict.
- How do command and event buses work with household/broadway?
- The package integrates Broadway's command and event buses with Laravel's container so commands and events can be resolved and dispatched through Laravel-style services. You typically bind or configure the buses, then dispatch command objects from controllers or application services. Domain events are published by aggregates and handled by projectors or other listeners.
- How do I define an aggregate with household/broadway?
- Define aggregates as Broadway aggregate roots and implement handler methods for your commands, recording domain events as state changes occur. Register or configure the aggregate so the command bus can route commands to it. Keep aggregate methods focused on invariants and avoid doing read-model queries inside the aggregate.
- How are projections and read models handled?
- Projections listen to domain events and update read models that are optimized for queries. The Laravel integration helps register projectors and read-model infrastructure in the application container. You can use Eloquent models or custom query services on the read side while keeping the write side event sourced.
- Can I use Eloquent models as read models with household/broadway?
- Yes, read models are separate from the event-sourced write side, so Eloquent models are a common choice for projections. A projector can listen for events and create, update, or delete Eloquent records. Keep projection handling idempotent because events may be replayed.
- How do I test CQRS and event sourcing code with household/broadway?
- The package includes infrastructure and testing helpers intended for CQRS and event sourced applications. In tests, use in-memory or test event stores and buses where possible, then assert recorded events or projection state. Check the README for the specific test helpers and base test cases provided.
- Is household/broadway suitable for production?
- It can be used in production as Laravel infrastructure around Broadway, but you must choose and configure a durable event store and message handling strategy. Review the package maintenance status, Laravel/PHP version constraints, and event store reliability before relying on it. For critical systems, plan for event replay, projection rebuilds, and monitoring.
- What are alternatives to household/broadway for event sourcing in Laravel?
- Alternatives include using Broadway directly, EventSauce, Spatie's laravel-event-sourcing, Ecotone, and Prooph components. The best choice depends on whether you want a full CQRS framework, Laravel-first ergonomics, or lightweight event sourcing. household/broadway is specifically aimed at developers who want Broadway concepts integrated into Laravel.