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

Abandoned → [palmtree/collection](/?search=palmtree%2Fcollection)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

palmtree/easy-collection
========================

Immutable collections which provide commonly used functionality missing from arrays

v2.1.0(3y ago)04.9kMITPHPPHP ^8.1

Since Dec 11Pushed 2y ago1 watchersCompare

[ Source](https://github.com/palmtreephp/easy-collection)[ Packagist](https://packagist.org/packages/palmtree/easy-collection)[ RSS](/packages/palmtree-easy-collection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (27)Used By (0)

WARNING: THIS REPO IS ABANDONDED. THE LIBRARY IS BEING MAINTAINED UNDER A NEW NAME AND A [NEW HOME](https://github.com/palmtreephp/collection)
----------------------------------------------------------------------------------------------------------------------------------------------

[](#warning-this-repo-is-abandonded-the-library-is-being-maintained-under-a-new-name-and-a-new-home)

🌴 Easy Collection
=================

[](#palm_tree-easy-collection)

[![License](https://camo.githubusercontent.com/23115dbc4aaac446dd443b404e21e7f7acfe1494616aa02533c4ce0ef763ad66/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70616c6d747265657068702f656173792d636f6c6c656374696f6e)](LICENSE)[![Build](https://camo.githubusercontent.com/7273707d66e93c505bcf217ed8838e524e84c52b57e6e49a8bf3ce119c683f37/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f70616c6d747265657068702f656173792d636f6c6c656374696f6e2f4275696c642e737667)](https://github.com/palmtreephp/easy-collection/actions/workflows/build.yml)

Immutable collections which provide commonly used functionality missing from arrays.

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

[](#requirements)

- PHP &gt;= 8.1

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

[](#installation)

Use composer to add the package to your dependencies:

```
composer require palmtree/easy-collection
```

Usage
-----

[](#usage)

Collections can be used just like arrays for the most part. They implement [`ArrayAccess`](https://www.php.net/manual/en/class.arrayaccess), [`Traversable`](https://www.php.net/manual/en/class.traversable) and [`Countable`](https://www.php.net/manual/en/class.countable):

```
use function Palmtree\EasyCollection\c;

$collection = c(['foo' => 'bar', 'baz' => 'qux']);

$foo = $collection['foo'];
$collection['baz2'] = 'qux';

isset($collection['baz']); // true
unset($collection['baz']);
count($collection);

foreach ($collection as $key => $value) {
    // do stuff with value and/or key
}

// find returns the first matching element
$foo = $collection->find(fn ($v) => $v === 'bar');

// filter returns a new filtered collection
$quxCollection = $collection->filter(fn ($v) => $v === 'qux');
```

```
use function Palmtree\EasyCollection\c;

$collection = c([1, 9, 5, 3, 7, 10])
    ->sort()
    ->filter(fn ($i) $i < 10)
    ->values()

// returns true as every element remaining in the collection is odd
$isAllOdd = $collection->every(fn ($i) => $i % 2 !== 0);
// returns false as it was removed in our filter
$collection->contains(10);

// returns true as at least one of the elements is false
c([true, true, false, true, true])->some(fn ($v) => !$v);
```

Many other methods are provided. Read through the documented [source code](src/Collection.php) to see more.

### Generics

[](#generics)

The library supports template annotations for use by static analysers such as Psalm and PHPStan:

```
/** @var Collection **/
$collection = new Collection();
$collection->add(new Foo());

foreach ($collection as $foo) {
    // Psalm/PHPStan and PhpStorm know that $foo is an instance of Foo here
}
```

License
-------

[](#license)

Released under the [MIT license](LICENSE)

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

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

Recently: every ~28 days

Total

26

Last Release

1240d ago

Major Versions

v1.1.2 → v2.0.02022-02-01

v1.2.4 → v2.0.122022-09-01

PHP version history (3 changes)v1.0.0PHP ^7.4||^8.0

v1.1.1PHP ^8.0

v2.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/93cd57de0c03bc08173bbe424ce641b70b1bb9421f8d8fd474a33409a0f1644d?d=identicon)[palmtree](/maintainers/palmtree)

---

Top Contributors

[![andyexeter](https://avatars.githubusercontent.com/u/6660584?v=4)](https://github.com/andyexeter "andyexeter (67 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[scheb/tombstone

Dead code detection with tombstones for PHP

282578.2k2](/packages/scheb-tombstone)

PHPackages © 2026

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