PHPackages                             lendable/aggregate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. lendable/aggregate

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lendable/aggregate
==================

Lendable Aggregate Library

1.2.1(2mo ago)2130.3k↑22.4%1[1 issues](https://github.com/Lendable/aggregate/issues)[3 PRs](https://github.com/Lendable/aggregate/pulls)MITPHPPHP ^8.3CI passing

Since Jun 2Pushed 1w ago42 watchersCompare

[ Source](https://github.com/Lendable/aggregate)[ Packagist](https://packagist.org/packages/lendable/aggregate)[ RSS](/packages/lendable-aggregate/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (24)Versions (27)Used By (0)

Lendable Aggregate
==================

[](#lendable-aggregate)

[![Latest Stable Version](https://camo.githubusercontent.com/016442373c571021e110f364f7c524c499d407a5817ef3e6f4df17628953c6da/68747470733a2f2f706f7365722e707567782e6f72672f6c656e6461626c652f6167677265676174652f762f737461626c65)](https://packagist.org/packages/lendable/aggregate)[![License](https://camo.githubusercontent.com/1e993ec935e2518400d1acb15c2695278cc7b43e80f539b2662fbcb6c7fede13/68747470733a2f2f706f7365722e707567782e6f72672f6c656e6461626c652f6167677265676174652f6c6963656e7365)](https://packagist.org/packages/lendable/aggregate)

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
------------

[](#installation)

You can install the library via [Composer](https://getcomposer.org/).

```
composer require lendable/aggregate
```

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4

Functionality
-------------

[](#functionality)

### `AggregateIdExtractor`

[](#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`

[](#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`

[](#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
---------------

[](#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'));
    }
}
```

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance83

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 67.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~149 days

Recently: every ~188 days

Total

13

Last Release

68d ago

Major Versions

0.4.0 → 1.0.02023-10-06

PHP version history (5 changes)0.1.0PHP &gt;=7.4.0

0.3.0PHP &gt;=8.0.0

1.0.0PHP &gt;=8.1.0

1.1.3PHP ^8.2

1.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/893f1dc6753940f80d1fe2e9a90db68961bb7f16eab85d6a868e7aecccf8de13?d=identicon)[ben-challis](/maintainers/ben-challis)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (576 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (158 commits)")[![ben-challis](https://avatars.githubusercontent.com/u/8275163?v=4)](https://github.com/ben-challis "ben-challis (87 commits)")[![marmichalski](https://avatars.githubusercontent.com/u/57528542?v=4)](https://github.com/marmichalski "marmichalski (20 commits)")[![lendabot[bot]](https://avatars.githubusercontent.com/u/10513749?v=4)](https://github.com/lendabot[bot] "lendabot[bot] (3 commits)")[![mdjward](https://avatars.githubusercontent.com/u/4046455?v=4)](https://github.com/mdjward "mdjward (3 commits)")[![mannion007](https://avatars.githubusercontent.com/u/5822816?v=4)](https://github.com/mannion007 "mannion007 (2 commits)")[![velkovb](https://avatars.githubusercontent.com/u/10958657?v=4)](https://github.com/velkovb "velkovb (1 commits)")[![martin-georgiev](https://avatars.githubusercontent.com/u/4849482?v=4)](https://github.com/martin-georgiev "martin-georgiev (1 commits)")[![mateuszsip](https://avatars.githubusercontent.com/u/1377075?v=4)](https://github.com/mateuszsip "mateuszsip (1 commits)")[![AlexisColes](https://avatars.githubusercontent.com/u/8488871?v=4)](https://github.com/AlexisColes "AlexisColes (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lendable-aggregate/health.svg)

```
[![Health](https://phpackages.com/badges/lendable-aggregate/health.svg)](https://phpackages.com/packages/lendable-aggregate)
```

###  Alternatives

[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k78.3k90](/packages/pocketmine-pocketmine-mp)[mynaparrot/plugnmeet-sdk

plugNmeet PHP SDK

102.8k](/packages/mynaparrot-plugnmeet-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
