Downloads
Stars
Version
This package allows you to use Eloquent as a custom message repository for EventSauce.
Heavily inspired by EventSaucePHP/DoctrineMessageRepository.
This package requires PHP 8.1 and Laravel 9 or higher.
composer require surgio/eloquent-message-repository:^2.0.0
Publish the migration:
php artisan vendor:publish --provider="Surgio\EloquentMessageRepository\EventSauceServiceProvider" --tag="migrations"
Migrate your database:
php artisan migrate
The Eloquent Message Repository implements EventSauce\EventSourcing\MessageRepository
and can be passed to any AggregateRootRepository
like so:
$aggregateRootRepository = new ConstructingAggregateRootRepository(
SomeProcess::class,
new EloquentMessageRepository(new ConstructingMessageSerializer())
);
You can run the tests with:
composer test