jjgrainger / collection
Simple collections in PHP
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 2
Open Issues: 1
pkg:composer/jjgrainger/collection
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: 8.*
- squizlabs/php_codesniffer: 3.*
This package is auto-updated.
Last update: 2025-09-29 02:08:47 UTC
README
A collection class for working with arrays
Principles
- Immutable - Most methods return a new collection, leaving the previous untouched
- Chainable - Methods can be chained to create fluent mapping and reduce original collection
Requirements
- PHP >=7.2
- Composer
Installation
$ composer require jjgrainger/collection
Usage
$collection = new Collection([1, 2, 3]); $total = $collection->sum(); // 6
Notes
- This project was created to learn unit testing, not intended for production use.
- Inspired by Laravel Collections
- Licensed under the MIT License
- Maintained under the Semantic Versioning Guide
Author
Joe Grainger