surgio / eloquent-message-repository
Eloquent Message Repository for EventSauce
v2.0
2024-01-05 20:23 UTC
Requires
- eventsauce/eventsauce: ^0.8.2
- ramsey/uuid: ^4.1
- surgiollc/eloquent-message-repository: dev-master
Requires (Dev)
- orchestra/testbench: ~3.0
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-03-05 23:26:07 UTC
README
This package allows you to use Eloquent as a custom message repository for EventSauce.
Heavily inspired by EventSaucePHP/DoctrineMessageRepository.
Requirements
This package requires PHP 8.1 and Laravel 9 or higher.
Installation
composer require surgio/eloquent-message-repository:^2.0.0
Setup
Publish the migration:
php artisan vendor:publish --provider="Surgio\EloquentMessageRepository\EventSauceServiceProvider" --tag="migrations"
Migrate your database:
php artisan migrate
Usage
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())
);
Testing
You can run the tests with:
composer test