damgru/stupid-event-sourcing-symfony
event_store). Schema migrations must align with the package’s expectations (e.g., id, aggregate_id, event_name, payload, occurred_at).php bin/console es:project). Requires CLI access and may need customization for async projection updates.Command base class. Would need rewriting or a proxy system.laravel-horizon) isn’t directly compatible with Symfony Messenger. Event dispatching would need custom routing.Why Event Sourcing?
Stack Compatibility
Event Modeling
OrderCreated) or fine-grained (e.g., OrderItemAdded)? The package assumes events are serialized; complex objects may need custom serialization logic.Performance & Scaling
Alternatives
spatie/laravel-event-sourcing (simpler, Laravel-native)prooph/event-store (more feature-rich, but heavier)ContainerInterface with Laravel’s Illuminate\Container\Container.php artisan es:project → StupidEventSourcing::project()).\DB) or Doctrine DBAL (if installed via doctrine/dbal).EventSourcingServiceProvider).Order) to validate the approach.damgru/stupid-event-sourcing-symfony, project to a Laravel table via a scheduled job.| Laravel Component | Compatibility Risk | Mitigation Strategy |
|---|---|---|
| Service Container | Symfony DI vs. Laravel’s Pimple-based container | Use Laravel’s bind() or a facade pattern. |
| Artisan Console | Symfony Command class not available |
Create Laravel commands that call package methods. |
| Database (Eloquent/DBAL) | Schema differences (e.g., snake_case vs. camelCase) | Configure DBAL to match Laravel’s conventions. |
| Queues/Messenger | No native Symfony Messenger support | Dispatch events to Laravel queues; consume via workers. |
| Testing | Symfony’s TestCase not available |
Use Laravel’s PHPUnit with custom event store mocks. |
damgru/stupid-event-sourcing-symfony and doctrine/dbal (if not present).config/database.php.Schema::create('event_store', function (Blueprint $table) {
$table->id();
$table->string('aggregate_id');
$table->string('event_name');
$table->json('payload');
$table->timestamp('occurred_at');
});
$this->app->bind('event_store', function ($app) {
return new \Damgru\StupidEventSourcingSymfony\EventStore(
$app['db']->connection()->getDoctrineSchemaManager()
);
});
php artisan es:project:run).OrderCreated, OrderPaid).use Damgru\StupidEventSourcingSymfony\EventStore;
class OrderService {
public function __construct(private EventStore $eventStore) {}
public function createOrder() {
$event = new OrderCreated(...);
$this->eventStore->record('order-123', $event);
}
}
orders table) and update them via projections.symfony/console → symfony/console polyfill).How can I help you explore Laravel packages today?