Skip to content

Laravel Event Sourcing Generator

One Artisan command scaffolds a complete event-sourced domain — events, projections, projectors, aggregates, reactors, actions, DTOs, notifications and PHPUnit tests — optionally straight from an existing migration.

Spatie’s Laravel Event Sourcing is powerful, but wiring up every event, projection, projector, aggregate and reactor by hand is repetitive. This package generates the whole domain structure — consistently, and optionally from an existing database migration — so you can focus on behaviour instead of boilerplate.

Complete domains

Events, projections, projectors, actions and DTOs every time; aggregates and reactors on demand.

From your migrations

Parse an existing migration and map every column into the DTO, projection and projector automatically.

Tests included

Generate working PHPUnit tests covering create / update / delete out of the box.

Notifications

Optional database, mail, Slack and Teams notifications, with failed-event variants.

Terminal window
composer require albertoarena/laravel-event-sourcing-generator

Then generate your first domain:

Terminal window
php artisan make:event-sourcing-domain Animal --domain=Animal

See Installation for compatibility, and the Quick start for what gets generated.