jsellis/eloquent-message-repository

Eloquent Message Repository for EventSauce

v1.0.3 2018-06-22 18:52 UTC

This package is not auto-updated.

Last update: 2024-03-17 03:03:57 UTC


README

Build Status Latest Stable Version

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 jsellis/eloquent-message-repository:^1.0.0

Setup

Publish the migration:

php artisan vendor:publish --provider="JSellis\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