PHPackages                             phlak/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phlak/collection

Abandoned → [tightenco/collect](/?search=tightenco%2Fcollect)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

phlak/collection
================

Lightweight collection library

0.1.0(8y ago)292MITPHPPHP &gt;=5.6

Since Sep 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/PHLAK/Collection)[ Packagist](https://packagist.org/packages/phlak/collection)[ RSS](/packages/phlak-collection/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (2)Used By (0)

Collection
==========

[](#collection)

[![Latest Stable Version](https://camo.githubusercontent.com/9a3086e2eedb7c972164af2f0d4aefd9f7238af642c283fd62b936f76b6449c2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f50484c414b2f436f6c6c656374696f6e2e737667)](https://packagist.org/packages/PHLAK/Collection)[![Total Downloads](https://camo.githubusercontent.com/a23bba228568fe42b890b1fe7014e78d8dd4c3553ee469b9f466dab54bcf31c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f50484c414b2f436f6c6c656374696f6e2e737667)](https://packagist.org/packages/PHLAK/Collection)[![Author](https://camo.githubusercontent.com/31ecaaf4b83988f786a502e70dcde7438fbefb66ba43b76983c032e5810bdae3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d43687269732532304b616e6b69657769637a2d626c75652e737667)](https://www.ChrisKankiewicz.com)[![License](https://camo.githubusercontent.com/52732257b345d9fc94d3b7c66f887d24e0aebeee7b4768d585f83d283be92b6d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f50484c414b2f436f6c6c656374696f6e2e737667)](https://packagist.org/packages/PHLAK/Collection)[![Build Status](https://camo.githubusercontent.com/501d8dd8ff15f36203d6189cd8e08c751681e7cc0b7456a7eb67d04c550fc184/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f50484c414b2f436f6c6c656374696f6e2e737667)](https://travis-ci.org/PHLAK/Collection)[![StyleCI](https://camo.githubusercontent.com/6612ece688beafe3a3948da6f4b1b3104fcd3af7478a854a9de9986aa1334383/68747470733a2f2f7374796c6563692e696f2f7265706f732f39313737303332372f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://styleci.io/repos/91770327)

Lightweight collection library -- by, [Chris Kankiewicz](https://www.ChrisKankiewicz.com)

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

[](#requirements)

- [PHP](https://php.net) &gt;= 5.6

Install with Composer
---------------------

[](#install-with-composer)

```
composer require phlak/collection
```

Initializing the Client
-----------------------

[](#initializing-the-client)

First, import Collection:

```
use PHLAK\Collection;
```

Then pass an array of items to the `Collection` class or the static `make` method:

```
$collection = new Collection\Collection(['foo', 'bar', 'baz']);

// or

$collection = Collection\Collection::make(['foo', 'bar', 'baz']);
```

Usage
-----

[](#usage)

Iterate over each item in a collection and perform an action via a Closure:

```
$collection->each(Closure $function);
```

Map each item of the collection to a new value via a Closure:

```
$collection->map(Closure $function);
```

Filter the items in a collection by returning only the items where the Closure returns true:

```
$collection->filter(Closure $function);
```

Filter the items in a collection by returning only the items where the Closure returns `false` (opposite of the `filter` method):

```
$collection->reject(Closure $function);
```

Reduce a collection down to a single item by iterating over the Closure until a single item remains:

```
$collection->reduce(Closure $function, $initial);
```

Sum all the items in a collection and return the value:

```
$collection->sum(Closure $function, $initial);
```

Changelog
---------

[](#changelog)

A list of changes can be found on the [GitHub Releases](https://github.com/PHLAK/Collection/releases) page.

Troubleshooting
---------------

[](#troubleshooting)

Please report bugs to the [GitHub Issue Tracker](https://github.com/PHLAK/Collection/issues).

Copyright
---------

[](#copyright)

This project is liscensed under the [MIT License](https://github.com/PHLAK/Collection/blob/master/LICENSE).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3221d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/53531?v=4)[Chris Kankiewicz](/maintainers/PHLAK)[@PHLAK](https://github.com/PHLAK)

---

Top Contributors

[![PHLAK](https://avatars.githubusercontent.com/u/53531?v=4)](https://github.com/PHLAK "PHLAK (18 commits)")

---

Tags

collectionphp

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

PHPackages © 2026

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