Create typed collections and defer logic to collection kernel

0.5.4 2022-06-28 04:04 UTC

This package is auto-updated.

Last update: 2024-07-10 01:26:53 UTC


A message to Russian 🇷🇺 people

If you currently live in Russia, please read this message.

Stand With Ukraine

Stand With Ukraine Latest Version on Packagist Build Status Code Quality Code Coverage Total Downloads Software License Required PHP Version


This package facilitates the creation of typed collections without having to duplicate underlying logic. Due to PHP's enforcement of Liskov Substitution Principle via method covariance and contravariance, 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.


Via Composer

composer require webtheory/collection


Change log

Please see CHANGELOG for more information on what has changed recently.


composer test


Please see CONTRIBUTING and CODE_OF_CONDUCT for details.


If you discover any security related issues, please email spider.mane.web@gmail.com instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.