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

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

headsnet/collections
====================

Base classes for collections

v0.2.1(2y ago)113.3k↑33.3%MITPHPPHP &gt;=8.1

Since Jun 18Pushed 2y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

[![Build Status](https://github.com/headsnet/collections/actions/workflows/ci.yml/badge.svg)](https://github.com/headsnet/collections/actions/workflows/ci.yml/badge.svg)[![Coverage](https://raw.githubusercontent.com/headsnet/collections/image-data/coverage.svg)](https://raw.githubusercontent.com/headsnet/collections/image-data/coverage.svg)[![Latest Stable Version](https://camo.githubusercontent.com/2d57696c585090ce42213b44c5b0006c988b265facf5ad1895b62e4d7b05f393/68747470733a2f2f706f7365722e707567782e6f72672f68656164736e65742f636f6c6c656374696f6e732f76)](//packagist.org/packages/headsnet/collections)[![Total Downloads](https://camo.githubusercontent.com/d388f0e7e5195f8196ed9391c5731082089a61e605aa235b5a680c81e706def0/68747470733a2f2f706f7365722e707567782e6f72672f68656164736e65742f636f6c6c656374696f6e732f646f776e6c6f616473)](//packagist.org/packages/headsnet/collections)[![License](https://camo.githubusercontent.com/903af8b85f0aa35a826e1b90eef31c1bd460f99a0dbcf48eceb39ff23ddb98fc/68747470733a2f2f706f7365722e707567782e6f72672f68656164736e65742f636f6c6c656374696f6e732f6c6963656e7365)](//packagist.org/packages/headsnet/collections)

Headsnet Collections
====================

[](#headsnet-collections)

### Installation

[](#installation)

```
composer require headsnet/collections
```

### Usage

[](#usage)

Assuming you have some class `Foo` that you want to put into a collection:

```
final class Foo
{
    public function __construct(
        public string $name
    ) {
    }
}
```

Then create a custom named collection to hold the `Foo` instances:

```
/**
 * @extends AbstractImmutableCollection
 *
 * @method self filter(callable $func)
 * @method self reverse()
 */
final class FooCollection extends AbstractImmutableCollection
{
    public function getItemClassName(): string
    {
        return Foo::class;
    }
}
```

Then instantiate the collection:

```
$foo1 = new Foo();
$foo2 = new Foo();

$allFoos = new FooCollection([$foo1, $foo2]);
```

You then have an immutable, iterable object that can be filtered, mapped and walked:

```
foreach ($allFoos as $foo) {
    $this->assertInstanceOf(Foo::class, $foo);
}
```

### Contributing

[](#contributing)

Contributions are welcome. Please submit pull requests with one fix/feature per pull request.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~324 days

Total

5

Last Release

861d ago

PHP version history (2 changes)v0.1.0PHP &gt;=7.4

v0.2.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/baad3e4bf78f55c3242e2e84839614395ce22d21da10fd4379a57fcf2608611d?d=identicon)[benr77](/maintainers/benr77)

---

Top Contributors

[![benr77](https://avatars.githubusercontent.com/u/2156742?v=4)](https://github.com/benr77 "benr77 (38 commits)")

---

Tags

phpcollection

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[werxe/laravel-collection-macros

Custom Laravel Collection macros.

2625.8k](/packages/werxe-laravel-collection-macros)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[jshannon63/jsoncollect

Supercharge your JSON using collections

154.9k1](/packages/jshannon63-jsoncollect)

PHPackages © 2026

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