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

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

ghostwriter/collection
======================

Provides a Collection implementation for PHP

2.0.0(2y ago)33.7M—6.7%8BSD-3-ClausePHPPHP &gt;=8.3CI failing

Since Jun 22Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/ghostwriter/collection)[ Packagist](https://packagist.org/packages/ghostwriter/collection)[ Docs](https://github.com/ghostwriter/collection)[ GitHub Sponsors](https://github.com/sponsors/ghostwriter)[ RSS](/packages/ghostwriter-collection/feed)WikiDiscussions 2.0.x Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (27)Used By (8)

Collection
==========

[](#collection)

[![GitHub Sponsors](https://camo.githubusercontent.com/dc14ea85057f9d6c97681358352c7a6d4d62a286556f4acb1f078748023a74f4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f67686f73747772697465723f6c6162656c3d53706f6e736f722b4067686f73747772697465722f636f6c6c656374696f6e266c6f676f3d4769744875622b53706f6e736f7273)](https://github.com/sponsors/ghostwriter)[![Automation](https://github.com/ghostwriter/collection/actions/workflows/automation.yml/badge.svg)](https://github.com/ghostwriter/collection/actions/workflows/automation.yml)[![Supported PHP Version](https://camo.githubusercontent.com/fba015b85c6aeded0276dc13b09fefa4f6a178365295ca2fc952192fafb710f8/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f67686f73747772697465722f636f6c6c656374696f6e3f636f6c6f723d383839326266)](https://www.php.net/supported-versions)[![Downloads](https://camo.githubusercontent.com/fd9863d4cc19e65fa70b378e2e30ab7b20ad4abb4738b25e4bc1343501c716fa/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f64742f67686f73747772697465722f636f6c6c656374696f6e3f636f6c6f723d626c7565)](https://packagist.org/packages/ghostwriter/collection)

Provides a Collection implementation for PHP.

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

[](#installation)

You can install the package via composer:

```
composer require ghostwriter/collection
```

### Star ⭐️ this repo if you find it useful

[](#star-️-this-repo-if-you-find-it-useful)

You can also star (🌟) this repo to find it easier later.

Usage
-----

[](#usage)

```
/** @var \Ghostwriter\Collection\Collection $collection */
$collection = Collection::new([1, 2, 3])
    ->append([4, 5, 6, 7, 8, 9])
    ->map(static fn ($v): int => $v * 10)
    ->filter(static fn ($v): bool => 0 === $v % 20);

$collection->toArray();  // [20, 40, 60, 80]
$collection->drop(1)     // [40, 60, 80]
           ->take(2)     // [40, 60]
           ->slice(1, 1) // [60]
           ->toArray();  // [60]
```

### Credits

[](#credits)

- [Nathanael Esayeas](https://github.com/ghostwriter)
- [All Contributors](https://github.com/ghostwriter/collection/contributors)

Thank you
---------

[](#thank-you)

Thank you for freely sharing your knowledge, insight and free time with me. I am grateful for your help and support.

- [Larry Garfield](https://github.com/crell)
- [Aleksei Khudiakov](https://github.com/xerkus)
- [Andi Rückauer](https://github.com/arueckauer)

### Changelog

[](#changelog)

Please see [CHANGELOG.md](./CHANGELOG.md) for more information on what has changed recently.

### License

[](#license)

Please see [LICENSE](./LICENSE) for more information on the license that applies to this project.

### Security

[](#security)

Please see [SECURITY.md](./SECURITY.md) for more information on security disclosure process.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance60

Regular maintenance activity

Popularity46

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity73

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

Recently: every ~236 days

Total

20

Last Release

54d ago

Major Versions

0.5.1 → 1.0.02022-12-02

1.4.0 → 2.0.02024-02-22

2.1.x-dev → 3.0.x-dev2026-03-25

PHP version history (8 changes)0.1.0PHP &gt;=8.0,&lt;8.2

0.5.0PHP &gt;=8.0,&lt;8.3

1.2.0PHP &gt;=8.1,&lt;8.3

1.3.1PHP &gt;=8.1 &lt;8.3

1.3.2PHP &gt;=8.1 &lt;8.4

1.4.0PHP &gt;=8.1

2.0.0PHP &gt;=8.3

2.0.x-devPHP ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1dbb0131801cc451dad9917ab29aa823b25d7eebc9f3875a9d481d109bdb44ee?d=identicon)[ghostwriter](/maintainers/ghostwriter)

---

Top Contributors

[![ghostwriter](https://avatars.githubusercontent.com/u/9754361?v=4)](https://github.com/ghostwriter "ghostwriter (1119 commits)")

---

Tags

collectionghostwritercollectionghostwriter

### Embed Badge

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

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

###  Alternatives

[phpcollection/phpcollection

General-Purpose Collection Library for PHP

1.0k64.0M34](/packages/phpcollection-phpcollection)[league/period

Time range API for PHP

7335.4M21](/packages/league-period)[loophp/collection

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

745663.8k13](/packages/loophp-collection)[lorisleiva/lody

Load files and classes as lazy collections in Laravel.

956.6M9](/packages/lorisleiva-lody)[pragmarx/coollection

Laravel Illuminate collection with objectified properties

943.4M11](/packages/pragmarx-coollection)[pragmarx/ia-collection

Laravel Illuminate Agnostic Collection

473.4M2](/packages/pragmarx-ia-collection)

PHPackages © 2026

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