PHPackages                             kununu/collections - 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. kununu/collections

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

kununu/collections
==================

To reduce boilerplate associated with collections

v7.0.0(3mo ago)133.1k↑25.5%[1 issues](https://github.com/kununu/collections/issues)1MITPHPPHP &gt;=8.4CI passing

Since Aug 17Pushed 3mo ago7 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (45)Used By (1)

Collections
===========

[](#collections)

The goal of this library is to provide some boilerplate code to assist you in creating more friendly collections when using `ArrayIterator`.

Install
-------

[](#install)

You can use this library by issuing the following command:

```
composer require kununu/collections
```

Running Tests
-------------

[](#running-tests)

Run the tests by doing:

```
composer install
vendor/bin/phpunit
```

or

```
composer install
composer test
```

To run test and generate coverage information:

```
composer install
composer test-coverage
```

Usage
-----

[](#usage)

The library defines interfaces to deal with collections and also boilerplate code with default implementations.

You can either use the provided traits to your custom class extending `ArrayIterator` or simply expand the abstract collection classes using them.

It has a default implementation for a "basic" collection and also one to filter and group data on your collections (a "filterable" collection).

It defines interfaces to convert collection items to `array`, `string` and `int` and to compare items.

More details:

- [Collection Interfaces](docs/collection-interfaces.md)
- [Collection Trait](docs/collection-trait.md)
- [Filterable Collection Trait](docs/filterable-collection-trait.md)
- [Auto Sortable OffsetSet Trait](docs/autosortable-offsetset-trait.md)
- [Convertible](docs/convertible.md)
- [Abstract Collections](docs/abstract-collections.md)
- [Key Value](docs/key-value.md)
    - [AbstractEnumKeyValue](docs/abstract-enum-key-value.md)
- [Abstract Item](docs/abstract-item.md)
- [Mapper](docs/mapper.md)
- [Collections Test Case](docs/abstract-collection-test-case.md)

Contribute
----------

[](#contribute)

If you are interested in contributing read our [contributing guidelines](/CONTRIBUTING.md).

---

[![Continuous Integration](https://github.com/kununu/collections/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/kununu/collections/actions/workflows/continuous-integration.yml/badge.svg)[![Quality Gate Status](https://camo.githubusercontent.com/6e2af7e159216fc203c5c5f7bb9df96b7ed5e936d547cdbfa15c6749520dd2e4/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d6b756e756e755f636f6c6c656374696f6e73266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=kununu_collections)

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance62

Regular maintenance activity

Popularity30

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 72.9% 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 ~49 days

Total

42

Last Release

95d ago

Major Versions

v5.2.1 → v6.0.02025-04-23

v5.3.0 → v6.1.02025-06-16

v5.4.0 → v6.2.02025-07-03

v5.5.0 → v6.3.02025-08-05

v6.6.0 → v7.0.02026-02-12

PHP version history (6 changes)v1.0.0PHP ^7.2

v1.6.3PHP &gt;=7.2

v2.0.0PHP &gt;=8.0

v4.0.0PHP &gt;=8.1

v6.0.0PHP &gt;=8.3

v7.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/41483600?v=4)[Hugo Gonçalves](/maintainers/hugo-goncalves-kununu)[@hugo-goncalves-kununu](https://github.com/hugo-goncalves-kununu)

---

Top Contributors

[![hugo-goncalves-kununu](https://avatars.githubusercontent.com/u/41483600?v=4)](https://github.com/hugo-goncalves-kununu "hugo-goncalves-kununu (51 commits)")[![tdashton](https://avatars.githubusercontent.com/u/820379?v=4)](https://github.com/tdashton "tdashton (12 commits)")[![csizmazia](https://avatars.githubusercontent.com/u/2581924?v=4)](https://github.com/csizmazia "csizmazia (2 commits)")[![joaoalves-kununu](https://avatars.githubusercontent.com/u/22587229?v=4)](https://github.com/joaoalves-kununu "joaoalves-kununu (2 commits)")[![usmichael](https://avatars.githubusercontent.com/u/25005284?v=4)](https://github.com/usmichael "usmichael (2 commits)")[![sergionogueirakununu](https://avatars.githubusercontent.com/u/40758627?v=4)](https://github.com/sergionogueirakununu "sergionogueirakununu (1 commits)")

---

Tags

collections

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kununu-collections/health.svg)

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

###  Alternatives

[doctrine/collections

PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.

6.0k411.1M1.2k](/packages/doctrine-collections)[dusank/knapsack

Collection library for PHP

5351.0M25](/packages/dusank-knapsack)[qaribou/immutable.php

Immutable, highly-performant collections, well-suited for functional programming and memory-intensive applications.

344146.0k](/packages/qaribou-immutablephp)[ilya/belt

A handful of tools for PHP developers.

71020.8k1](/packages/ilya-belt)[xi/collections

Functional, immutable and extensible enumerations and collections for PHP 5.3.

26100.6k1](/packages/xi-collections)[malarzm/collections

Various implementations of Doctrine's Collection interface

2368.1k](/packages/malarzm-collections)

PHPackages © 2026

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