prooph/event-sourcing
Lightweight PHP event sourcing library with out-of-the-box integration for prooph/event-store. Provides an AggregateRoot base and AggregateTranslator, plus UUID generation and assertions support. Note: project was supported until Dec 31, 2019 and is deprecated.
array_unpack, match expressions) in aggregate logic.prooph/service-bus).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Storage Backend Dependency | High | Evaluate Doctrine DBAL or EventStoreDB compatibility; avoid vendor lock-in. |
| Performance Overhead | Medium | Benchmark event loading with PHP 8.1 JIT; consider snapshotting. |
| Laravel Ecosystem Gaps | Medium | Use Laravel’s service container to wrap aggregates; bridge with Lumen if needed. |
| Concurrency Issues | High | Implement optimistic locking (ExpectedVersion) or pessimistic locks. |
| Debugging Complexity | High | Log event streams; use Laravel’s debugbar for aggregate state. |
| PHP 8.1 Migration Risk | Low | Backward-compatible (no breaking changes in v5.7.0); test with Laravel 9/10. |
match expressions for event handling)?laravel-queue for async event publishing (e.g., bus->dispatch()).| Phase | Action Items | Tools/Libraries |
|---|---|---|
| Assessment | Audit existing CRUD models for ES suitability; identify bounded contexts. | DDD tools, Laravel Scout (for analysis) |
| Proof of Concept | Implement 1-2 aggregates (e.g., Order, UserProfile) with event sourcing, using PHP 8.1 features. |
prooph/event-sourcing, Tinker for testing |
| Storage Integration | Choose and configure event store (Doctrine DBAL/Redis/EventStoreDB). | Doctrine DBAL, Predis, EventStore PHP client |
| Command Handling | Replace Eloquent updates with command handlers (e.g., UpdateOrder), leveraging PHP 8.1 attributes. |
prooph/service-bus (optional) |
| Projection Layer | Build read models (e.g., Laravel Eloquent or custom tables) with PHP 8.1 typed properties. | Laravel Migrations, Query Builder |
| Testing | Write event replay tests and aggregate state tests, using PHP 8.1’s attributes for test fixtures. | PHPUnit, Laravel Pest |
| Deployment | Gradually migrate write paths to ES; monitor performance & errors with PHP 8.1’s profiling tools. | Laravel Forge/Envoyer, Sentry, Xdebug |
schedule:run) for projections.User model to an event-sourced aggregate (UserAggregate) using PHP 8.1’s typed properties.EventVersion field) with PHP 8.1’s enums.users_view) updated via Laravel jobs, using PHP 8.1’s fibers for async updates.UpdateUserCommand) using PHP 8.1’s attributes for dependency injection.How can I help you explore Laravel packages today?