Registry /
orm / spatie-laravel-event-sourcing
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AggregateRoot
✓ use Spatie\EventSourcing\AggregateRoots\AggregateRoot;
Define an aggregate root and record events.
<?php
namespace App\Aggregates;
use Spatie\EventSourcing\AggregateRoots\AggregateRoot;
class AccountAggregate extends AggregateRoot
{
public function createAccount(string $name): self
{
$this->recordThat(new AccountCreated($name));
return $this;
}
}
$aggregate = AccountAggregate::retrieve('uuid');
$aggregate->createAccount('John');
$aggregate->persist();
Upgrade
Version history
7.12.6latest on Packagist
Audit
Dependencies
No dependency data recorded yet.