jsellis/eloquent-message-repository

EventSauce 的 Eloquent 消息存储库

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

This package is not auto-updated.

Last update: 2024-09-29 05:33:45 UTC


README

Build Status Latest Stable Version

此包允许您使用 Eloquent 作为 EventSauce 的自定义消息存储库。

深受 EventSaucePHP/DoctrineMessageRepository 的启发。

要求

此包需要 PHP 7.2 和 Laravel 5.6 或更高版本。

安装

composer require jsellis/eloquent-message-repository:^1.0.0

设置

发布迁移

php artisan vendor:publish --provider="JSellis\EloquentMessageRepository\EventSauceServiceProvider" --tag="migrations"

迁移您的数据库

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())
);

测试

您可以使用以下命令运行测试

composer test