Registry / orm / spatie-laravel-event-sourcing

spatie-laravel-event-sourcing

JSON →
library7.12.6phppackagistunverified

The easiest way to get started with event sourcing in Laravel, providing aggregates, projections, and reactors.

composer require spatie/laravel-event-sourcing
INSTALL
IMPORT
SIG · SPATIE-LARAVEL-EVE
S
spatie-laravel-event-sourcing
ormphpv7.12.6
harness data pending
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();
Debug
Known issues
breakingRequires Laravel 8+ and PHP 8.0+.
fix
Upgrade Laravel or PHP version.
affects: >=7.0.0
Upgrade
Version history
7.12.6latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
42 hits · last 30 days
node
40
Resources
spatie-laravel-event-sourcing — pip install spatie-laravel-event-sourcing · libregistry