PHPackages                             rekalogika/doctrine-collections-decorator - 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. [Database &amp; ORM](/categories/database)
4. /
5. rekalogika/doctrine-collections-decorator

ActiveLibrary[Database &amp; ORM](/categories/database)

rekalogika/doctrine-collections-decorator
=========================================

Lets you easily create decorator classes to dynamically modify the behaviors of Doctrine Collection objects, including the collection objects used by Doctrine ORM in your entities.

2.3.0(2y ago)451.8k↑16.7%[1 PRs](https://github.com/rekalogika/doctrine-collections-decorator/pulls)2MITPHPPHP ^8.1

Since Oct 4Pushed 2y ago2 watchersCompare

[ Source](https://github.com/rekalogika/doctrine-collections-decorator)[ Packagist](https://packagist.org/packages/rekalogika/doctrine-collections-decorator)[ Docs](https://rekalogika.dev/doctrine-collections-decorator)[ RSS](/packages/rekalogika-doctrine-collections-decorator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (13)Used By (2)

rekalogika/doctrine-collections-decorator
=========================================

[](#rekalogikadoctrine-collections-decorator)

Lets you easily create decorator classes to dynamically modify the behaviors of Doctrine Collection objects, including the collection objects used by Doctrine ORM in your entities.

Motivation
----------

[](#motivation)

Custom collection classes won't come to Doctrine ORM anytime soon. Therefore, the only way to modify the behavior of a Doctrine collection is to use decorators. However, creating a Collection decorator by hand is a tedious process.

Synopsis
--------

[](#synopsis)

The decorator class extending one of our abstract classes:

```
use Doctrine\Common\Collections\Collection;
use Rekalogika\Collections\Decorator\AbstractCollectionDecorator;

/**
 * @extends AbstractCollectionDecorator
 */
class BookCollection extends AbstractCollectionDecorator
{
    /**
     * @param Collection $collection
     */
    public function __construct(private Collection $collection)
    {
    }

    protected function getWrapped(): Collection
    {
        return $this->collection;
    }

    // add and override methods here:
    // ...
}
```

The usage in an entity:

```
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity()]
class BookShelf
{
    /**
     * @var Collection
     */
    #[ORM\OneToMany(targetEntity: Book::class)]
    private Collection $books;

    public function __construct()
    {
        $this->books = new ArrayCollection();
    }

    public function getBooks(): BookCollection
    {
        return new BookCollection($this->bookskkk);
    }
}
```

Documentation
-------------

[](#documentation)

[rekalogika.dev/doctrine-collections-decorator](https://rekalogika.dev/doctrine-collections-decorator)

License
-------

[](#license)

MIT

Contributing
------------

[](#contributing)

Issues and pull requests should be filed in the GitHub repository [rekalogika/doctrine-collections-decorator](https://github.com/rekalogika/doctrine-collections-decorator).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% 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 ~22 days

Recently: every ~43 days

Total

9

Last Release

779d ago

Major Versions

1.0.0 → 2.0.02023-10-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/13d0eed333cf2f0d552e9a4d0ca1c6a8fc0be0506bbc5e7516f6985b17b86043?d=identicon)[priyadi](/maintainers/priyadi)

---

Top Contributors

[![priyadi](https://avatars.githubusercontent.com/u/1102197?v=4)](https://github.com/priyadi "priyadi (38 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

abstractcollectiondecoratordoctrineentityphpselectabletraitwrapperdoctrinetraitwrappercollectionentityabstractdecorator

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rekalogika-doctrine-collections-decorator/health.svg)

```
[![Health](https://phpackages.com/badges/rekalogika-doctrine-collections-decorator/health.svg)](https://phpackages.com/packages/rekalogika-doctrine-collections-decorator)
```

###  Alternatives

[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[api-platform/schema-generator

Various tools to generate a data model based on Schema.org vocables

4714.2M7](/packages/api-platform-schema-generator)[vlucas/spot2

Simple DataMapper built on top of Doctrine DBAL

605392.8k7](/packages/vlucas-spot2)[ergebnis/factory-bot

Provides a fixture factory for doctrine/orm entities.

81702.8k](/packages/ergebnis-factory-bot)[zenstruck/collection

Helpers for iterating/paginating/filtering collections (with Doctrine ORM/DBAL implementations and batch processing utilities).

16617.0k1](/packages/zenstruck-collection)[liqueurdetoile/cakephp-orm-json

Cakephp plugin to provide easy control over JSON type fields in database

1461.1k](/packages/liqueurdetoile-cakephp-orm-json)

PHPackages © 2026

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