small/collection
A lightweight collection package for PHP and Laravel that wraps arrays in a fluent, chainable API for filtering, mapping, grouping, sorting, and reducing data. Small and dependency-free, it keeps dataset manipulation readable and expressive.
Illuminate\Support\Collection plus a few private helpers good enough?" The package is small enough to be a reference implementation even if we never install it.if statements.Adopt only if all of these hold:
Illuminate\Support\Collection would be an unwanted coupling.map/filter/groupBy. The base collection value alone is trivially reproducible in an afternoon.Look elsewhere (or build in-house) when:
Illuminate\Support\Collection / LazyCollection already covers most of this and is maintained, documented, and known to every hire.LazyCollection, or pushing the query down to the database. In-memory selection is a convenience, not a scaling strategy.Gating step: a 1–2 day timeboxed spike against a real use case, with explicit pass/fail on (a) does the selector cover our filter shapes, (b) what does the boundary glue cost, (c) can we fork it in a day if needed. If any answer is uncomfortable, reimplement the ~200 lines internally.
To executives: This is a small, unproven open-source library that offers PHP collection classes plus a query selector for filtering in-memory data. It is not a recommended dependency today — zero adoption signals and an unfamiliar hosting origin mean we'd be taking on maintenance and supply-chain risk for something we could write ourselves in a day or two. The reason to look at it is narrower and more useful: it's a cheap reference design for two things on our roadmap — keeping domain logic framework-agnostic, and giving users self-serve filtering/reporting without a new endpoint per filter. Recommendation: fund a short, timeboxed evaluation, not adoption. Cost is low; the downside of skipping it is that we keep hand-rolling filter logic in several places.
To engineering: Treat small/collection as prior art. It bundles a collection type with a selector that maps a structured query onto predicates — interesting only if we want that outside Laravel's ecosystem. Concerns to validate: eager evaluation and memory profile, PHP version and framework compatibility, license and provenance, and the conversion tax at every boundary with Illuminate\Support\Collection. Default position is to stay on Laravel's collections; the exception is a genuinely framework-agnostic domain package, and even then we should compare "fork this" against "write a minimal internal version with only the operators we actually need." Success criteria for the spike: a working filter path for one real feature, a measured interop cost, and a written fork/exit plan — otherwise we close it out and move on.
How can I help you explore Laravel packages today?