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

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

vakata/collection
=================

PHP collection manipulation class - supports iterators and generators

1.8.7(1y ago)16.9k↓79.8%11MITPHPPHP &gt;=8.0

Since Mar 16Pushed 1y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (24)Used By (1)

collection
==========

[](#collection)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e8f1c4dec69485dce21a40a3d34c30176672e82c1d7dfe277de92ab5e026f23e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f76616b6174612f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vakata/collection)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/53198cb3f1217bb825990a6f790fcda1a40c87fb61c6f9475d2ca5a2e1cfc1ae/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f76616b6174612f636f6c6c656374696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/vakata/collection)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f0629a55dd292943bf6140513a7fabde9517d75935125ab571a32ae510fc736b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f76616b6174612f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/vakata/collection)[![Code Coverage](https://camo.githubusercontent.com/fe15524e887ffe2facd48d227bd400bc4c77b61702496772312e73f0715cee02/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f76616b6174612f636f6c6c656374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/vakata/collection)

A PHP class for fast iterables manipulation (arrays, generators, iterators).

All predicate / mutator callables receive the current value, current key and the whole collection as arguments.

`map` &amp; `filter` do not execute immediately, but instead stack up until you need to get a value (calling `squash`, `toArray`, `value`). Where possible helpers use `map` &amp; `filter` in order to minimize RAM usage. This means that it is possible to iterate through a large file reading line by line while maintaining a minimal memory footprint.

Install
-------

[](#install)

Via Composer

```
composer require vakata/collection
```

Usage
-----

[](#usage)

```
$collection = \vakata\collection\Collection::from([1,2,3,4,5,6]);
$result = $collection
    ->filter(function ($v) { return $v % 2 === 0; })
    ->map(function ($v) { return $v + 1; })
    ->head(2)
    ->toArray();
```

Read more in the [API docs](docs/README.md)

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

A big thanks to im0rtality and the great [Underscore package](https://github.com/Im0rtality/Underscore)

- [vakata](https://github.com/vakata)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance46

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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 ~135 days

Recently: every ~112 days

Total

23

Last Release

414d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.0

1.6.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/146052?v=4)[Ivan Bozhanov](/maintainers/vakata)[@vakata](https://github.com/vakata)

---

Top Contributors

[![vakata](https://avatars.githubusercontent.com/u/146052?v=4)](https://github.com/vakata "vakata (33 commits)")

---

Tags

collectionvakata

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.7M34](/packages/phpcollection-phpcollection)[aimeos/map

Easy and elegant handling of PHP arrays as array-like collection objects similar to jQuery and Laravel Collections

4.3k459.4k15](/packages/aimeos-map)[league/period

Time range API for PHP

7335.8M24](/packages/league-period)[loophp/collection

A (memory) friendly, easy, lazy and modular collection class.

745762.4k16](/packages/loophp-collection)[athari/yalinqo

YaLinqo, a LINQ-to-objects library for PHP

4581.2M5](/packages/athari-yalinqo)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

957.9M15](/packages/lorisleiva-lody)

PHPackages © 2026

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