surgiollc/eloquent-message-repository

Eloquent Message Repository for EventSauce

1.0.7 2021-04-28 17:49 UTC

This package is auto-updated.

Last update: 2021-11-16 04:37:39 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 7.2 and Laravel 5.6 or higher.

Installation

composer require surgio/eloquent-message-repository:^1.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