mf/collections-php
A lightweight collection library for PHP that brings expressive, chainable array manipulation to any project. Map, filter, reduce, group and transform data with a fluent API, plus optional Laravel integration for familiar collection-style workflows.
Architecture fit
Illuminate\Support\Collection as the de facto collection type. Introducing a second collection abstraction means every boundary (Eloquent models, resources, jobs, events) needs an explicit conversion policy, or the codebase ends up with two incompatible idioms.Integration feasibility
composer require with no bootstrap steps and an MIT license makes the mechanical install trivial.Technical risk
Key questions
Illuminate\Support\Collection, Laravel's Arr helpers, and native array_* functions do not — strict typing, PHPDoc generics for PHPStan/Psalm, immutability, typed maps/sets, nested-path operations?map, filter, merge, and flatten?Stack fit
Illuminate\Support\Collection.Migration path
MFCollections\... throughout the codebase. Introduce it behind an internal adapter or domain-level contract (e.g., App\Support\CollectionInterface) so the dependency is swappable and can be forked later without touching call sites.Compatibility
json_encode shape, serialize()/unserialize() round-trips, and behavior when collections are cached, queued, or returned from API resources. Silent shape drift here becomes an API contract bug.ArrayAccess, Iterator, Countable, and array_* functions if we rely on any of them.Sequencing
Maintenance
Support
Scaling
Failure modes
map/merge/flatten.Ramp-up
Recommendation
Illuminate\Support\Collection. Approve only a timeboxed spike, and only if the spike names a specific capability gap that Illuminate Collection and native arrays cannot close.Illuminate\Support\Collection and native arrays. With score 0.15, 10 stars, and zero dependents, the demonstrated value is thin relative to the real switching and ownership costs.How can I help you explore Laravel packages today?