yoshi2889/collections
A lightweight PHP collection library offering a fluent, chainable API for mapping, filtering, reducing, and transforming data. It brings expressive array manipulation to standalone PHP projects and Laravel apps alike, helping keep code concise, readable, and easy to maintain.
TypedCollection and stop carrying the dependency. This release makes "adopt" defensible for the first time, because the type parameter plus quality tooling closes the two gaps that usually push teams to build.array<int, Order> in a docblock currently does the work of a real type. The new collection type parameter turns those annotations into something static analysis can actually enforce and IDEs can autocomplete.Collection/LazyCollection. This package does not replace them and adopting it as a general-purpose collection layer would fragment the codebase.Consider it when:
@template-style generics and understands they are enforced by tooling, not the runtime.0.x, a minor bump is the conventional signal for breaking change, so upgrade checks must be manual.Look elsewhere (or build in-house) when:
Collection macros, or framework-integrated helpers. Use the framework's own classes.Migration note for the upgrade decision: treat 0.1.6 → 0.2 as a potentially breaking minor. Do not float the constraint; pin ^0.2, run the suite and the static analyser, and check subclasses and any code passing untyped arrays. The "quality tools" addition is a genuine maturity signal — CI and analysis on the upstream repo reduce regression risk — but it changes nothing at runtime for consumers.
For executives (one paragraph): A small open-source PHP utility we are evaluating received a useful update: it now supports typed collections, which lets our tooling catch a class of data-shape bugs at build time instead of in production, and the maintainer added automated quality checks, which lowers the odds of a bad release. It is a micro-dependency, not a platform decision — low cost, low blast radius, and we can contain it behind our own interface so switching away later is a small job. Recommendation: approve a short, time-boxed evaluation rather than an org-wide standard.
For engineering leads: The v0.2 headline is a type parameter on the collection class, so the value is entirely realised through static analysis — it pays off only where PHPStan/Psalm are already enforced. The 0.2 bump is a pre-1.0 minor and should be treated as a possible breaking change for subclasses and loosely-typed call sites. Ask for a one-day spike: pin ^0.2, wire it into one service boundary, confirm the analyser reports cleaner types, and wrap it behind an internal collection interface. If the spike doesn't show measurably fewer type errors, we build the trivial internal version and move on.
For the sponsor signing off: Success criteria are concrete — improved analyser signal at one integration point, no subclass breakage, and an exit cost under a day. Anything short of that and the answer is "not now," which is a perfectly good outcome for a package this small.
How can I help you explore Laravel packages today?