- What is macnificos/broadway used for in Laravel?
- It is a Laravel integration package for Broadway, the PHP toolkit for CQRS and event sourcing. It provides service provider bindings and configuration so you can connect command buses, event buses, event stores, and read models to a Laravel application. It is aimed at developers building auditable, domain-driven systems where state changes are captured as events.
- How do I install macnificos/broadway?
- Install it with Composer using composer require macnificos/broadway. Then register the package service provider if your Laravel version does not support package discovery, and publish any provided configuration files. Review the package README and composer.json for exact installation steps and required extensions, such as database drivers for your chosen event store.
- Which Laravel versions does macnificos/broadway support?
- Laravel version support is defined by the package's composer.json constraints, so check those before installing. The package relies on Laravel's service container and configuration system, and compatibility can vary between major Laravel releases. If you are on a newer Laravel version, verify the package's test suite or run a small integration test in your application.
- How do I configure command and event buses with this package?
- The package provides service provider bindings and configuration to wire Broadway command and event buses into Laravel's container. You typically configure bus implementations, middleware, and handlers through the published configuration and by binding your own handler classes. Exact keys and supported bus types should be confirmed in the package configuration file and README.
- Which event stores can I use with macnificos/broadway?
- The package integrates Broadway's event store abstractions, so supported stores depend on the Broadway adapters available in your project. Common options in the Broadway ecosystem include Doctrine DBAL and MongoDB-based stores, but you should confirm the adapters and configuration keys supported by this package. You remain responsible for setting up the underlying database or storage service.
- Do I still need to write aggregates and projectors myself?
- Yes. macnificos/broadway supplies Laravel infrastructure and testing helpers, not a full domain model generator. You define your aggregates, commands, events, handlers, and read-model projectors using Broadway's APIs and your domain design. The package helps bind those pieces into Laravel and test them more conveniently.
- Can I use macnificos/broadway for read models and projections?
- Yes, the package is intended to help connect Broadway read models and projections to your Laravel application. You can wire projectors to listen for events and update query-side tables or other read stores. The exact projector registration and event subscription setup depends on the package configuration and your chosen event bus implementation.
- How do I test event-sourced Laravel applications with this package?
- The package includes testing helpers intended to make Broadway-based CQRS and event sourcing easier to exercise in Laravel tests. You can typically test command handling, event recording, and projection behavior using your normal Laravel test suite with in-memory or test event stores. Check the package's documented helpers and avoid relying on production event stores in unit tests.
- Is macnificos/broadway suitable for production use?
- It can be used in production when paired with a reliable event store and a clear operational plan for event schema changes and projections. Before adopting it, review the package's release history, test coverage, and Laravel version constraints, since infrastructure packages require ongoing maintenance. Also plan for event store backups, projection rebuilds, and idempotent handlers.
- What are alternatives to macnificos/broadway for event sourcing in Laravel?
- Alternatives include Spatie's laravel-event-sourcing package, EventSauce integrations, prooph components, and using Broadway directly without a Laravel wrapper. Each option differs in domain modeling style, persistence adapters, and testing support. Choose based on your team's familiarity with Broadway, your required event store, and how much Laravel-specific glue you want the package to provide.