PHPackages                             affinity4/collection - 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. affinity4/collection

ActiveLibrary

affinity4/collection
====================

Iterable Collections with useful helper methods. Take control of your arrays!

1.0.0(6y ago)012MITPHP

Since Jun 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/affinity4/collection)[ Packagist](https://packagist.org/packages/affinity4/collection)[ RSS](/packages/affinity4-collection/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Affinity4 Collection
====================

[](#affinity4-collection)

Iterable Collections with useful helper methods. Take control of your arrays!

Installation
------------

[](#installation)

```
composer require affinity4/collection
```

Usage
-----

[](#usage)

Standard Iteratable API

```
require_once __DIR__ '/vendor/autoload.php';

use Affinity4\Collection;

$Collection = new Collection([
    0 => 'one',
    1 => 'two',
    2 => 'three'
]);

$Collection->key(); // 0
$Collection->current(); // one
$Collection->valid(); // true

$Collection->next();
$Collection->key(); // 1
$Collection->valid(); // true
$Collection->current(); // two

$Collection->next();
$Collection->key(); // 2
$Collection->valid(); // true
$Collection->current(); // three

$Collection->next();
$Collection->key(); // 3
$Collection->valid(); // false

$Collection->prev();
$Collection->key(); // 2
$Collection->valid(); // true
$Collection->current(); // three

$Collection->rewind();
$Collection->key(); // 0
$Collection->valid(); // true
$Collection->current(); // one
```

Standard ArrayAccess API

```
require_once __DIR__ '/vendor/autoload.php';

use Affinity4\Collection;

$Collection = new Collection([
    0       => 'one',
    1       => 'two',
    2       => 'three',
    'one'   => 1,
    'two'   => 2,
    'three' => 3
]);

$Collection[0]; // one
$Collection[1]; // two
$Collection[2]; // three

$Collection['one'];   // 1
$Collection['two'];   // 2
$Collection['three']; // 3
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

2540d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6eda764179ed00e7d50099142dc56015a0a5a44542d6df9bb80fe087418efceb?d=identicon)[Affinity4](/maintainers/Affinity4)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/affinity4-collection/health.svg)

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

PHPackages © 2026

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