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

ActiveLibrary

webtheory/collection
====================

Create typed collections and defer logic to collection kernel

0.5.4(3y ago)13711MITPHPPHP ^7.4 || ^8.0

Since Apr 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/spider-mane/collection)[ Packagist](https://packagist.org/packages/webtheory/collection)[ Docs](https://github.com/spider-mane/collection)[ RSS](/packages/webtheory-collection/feed)WikiDiscussions master Synced 1mo ago

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

Collection
==========

[](#collection)

A message to Russian 🇷🇺 people
------------------------------

[](#a-message-to-russian--people)

If you currently live in Russia, please read [this message](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/ToRussianPeople.md).

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)[![Latest Version on Packagist](https://camo.githubusercontent.com/4028c8063e1103cb51e67bdc92bede6fd0babfbaedc81b58b467e88b5e4f3fe8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7765627468656f72792f636f6c6c656374696f6e2e737667)](https://packagist.org/packages/webtheory/collection)[![Build Status](https://camo.githubusercontent.com/581e61a09d3f2d1a23ccda55e5cabb05509c30b298808e480d53217d95544d11/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f7370696465722d6d616e652f636f6c6c656374696f6e2e737667)](https://scrutinizer-ci.com/g/spider-mane/collection)[![Code Quality](https://camo.githubusercontent.com/e60c92c804ffe4654534c9b135e42214e75fff407b34a5d51b8d0415c71ee735/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370696465722d6d616e652f636f6c6c656374696f6e2e737667)](https://scrutinizer-ci.com/g/spider-mane/collection)[![Code Coverage](https://camo.githubusercontent.com/053123942da3622efedbff59395c09f483a552cd149a054545343145905f3098/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7370696465722d6d616e652f636f6c6c656374696f6e2e737667)](https://scrutinizer-ci.com/g/spider-mane/collection)[![Total Downloads](https://camo.githubusercontent.com/7be54c1b29636df4e61fa12efc8187d16917706a91cee426623c59634f7544d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765627468656f72792f636f6c6c656374696f6e2e737667)](https://packagist.org/packages/webtheory/collection/stats)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Required PHP Version](https://camo.githubusercontent.com/f64fb6241175fe44dd4ea15212ee264c5a56525305da6b968ba18a6e005c9126/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7765627468656f72792f636f6c6c656374696f6e2e7376673f636f6c6f72423d253233383839324246)](https://php.net)

Purpose
-------

[](#purpose)

This package facilitates the creation of typed collections without having to duplicate underlying logic. Due to PHP's enforcement of [Liskov Substitution Principle](https://php.watch/articles/php-lsp) via [method covariance and contravariance](https://www.php.net/manual/en/language.oop5.variance.php), it's not possible to create a natively typed collection using inheritance so long as you need methods that operate on specific types. This package provides a configurable 'collection kernel' class that stores and performs operations on a given array. Rather than inheritance, this paradigm uses composition to fulfil basic collection functionality. Besides enabling strong typing, one of the many benefits of this approach is that you have complete control over the operations to be exposed by your collections.

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

[](#installation)

Via Composer

```
composer require webtheory/collection
```

Usage
-----

[](#usage)

```
```

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Chris Williams](https://github.com/spider-mane)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

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

Every ~7 days

Total

10

Last Release

1420d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/42c6c17a141acad92bd90ad7b7e574ea19ecb332f33272a041261566670576cf?d=identicon)[webtheory](/maintainers/webtheory)

---

Top Contributors

[![spider-mane](https://avatars.githubusercontent.com/u/17187449?v=4)](https://github.com/spider-mane "spider-mane (33 commits)")

---

Tags

webtheory

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M263](/packages/ssch-typo3-rector)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)

PHPackages © 2026

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