定制 lendable/aggregate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lendable/aggregate

最新稳定版本:1.1.4

Composer 安装命令:

composer require lendable/aggregate

包简介

Lendable Aggregate Library

README 文档

README

Latest Stable Version License

Library with supporting functionality to bridge domain and infrastructure interactions for aggregates within event sourcing systems.

This does not help with building out your domain. Rather, it provides interfaces and base functionality for an infrastructure layer to interact with your aggregate classes without requiring them to implement library specific interfaces.

Installation

You can install the library via Composer.

composer require lendable/aggregate

Requirements

  • PHP >= 8.2

Functionality

AggregateIdExtractor

Defines a contract for extracting an AggregateId from domain aggregate objects. Your aggregate class should not hold an AggregateId instance, but instead a domain specific identifier type (e.g. UserId).

AggregateTypeResolver

Defines a contract for resolving an AggregateType from domain aggregate objects. An AggregateType is a classification of aggregate. This is an infrastructure concern, and is aimed towards audit logging alongside an AggregateId and single schema / multiple aggregate storage patterns.

AggregateVersionExtractor

Defines a contract for extracting an AggregateVersion from domain aggregate objects. This is an event sourcing infrastructure concept whereby (usually) the version increases for each event that has taken place to influence the state of the aggregate.

Testing support

The AggregateIdExtractorSpec, AggregateTypeResolverSpec and AggregateVersionExtractorSpec are provided to ease testing of your implementations. Simply extend these classes for your own test suite and implement the hook points.

use Lendable\Aggregate\Testing\AggregateIdExtractorSpec;
use Lendable\Aggregate\AggregateIdExtractor;
use Lendable\Aggregate\AggregateId;

final class FooIdExtractor extends AggregateIdExtractorSpec 
{
    protected function createExtractor(): AggregateIdExtractor
    {
        return new FooIdExtractor();
    }
    
    protected function createExpectedAggregateId(): AggregateId
    {
        return AggregateId::fromString('1406fd13-29d3-44e3-812c-c1cd14e12b38');
    }
    
    protected function createAggregateWithExpectedAggregateId(): object
    {
        return Foo::register(FooId::fromString('1406fd13-29d3-44e3-812c-c1cd14e12b38'));
    }
}

统计信息

  • 总下载量: 110.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 46
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-28