petrobolos/fixed-array-functions
Fixed Array Functions offers reliable, predictable replacements for common PHP array helpers, helping Laravel and PHP developers avoid edge-case bugs and inconsistent built-in behavior when searching, filtering, mapping, and manipulating arrays with safer key and value handling.
SplFixedArray stores data with far less per-element overhead than a standard PHP array, and this release brings the API to Laravel Collection parity (70+ methods). That removes the main historical objection — "we'd have to write our own helper methods" — and makes it viable to spec features over large numeric datasets (reporting tables, exports, batch aggregates) without provisioning more memory.sum(), avg(), min(), max(), partition(), pluck(), join(), and when()/unless(), teams can express aggregation and shaping logic in the same idiom they already use for Collections. As a PM this supports a single house style decision: Collection API for associative/dynamic data, this package for large fixed-shape numeric data — same vocabulary, lower cognitive load, fewer PR review debates.[$valid, $invalid]) over imported records.CONTRIBUTING.md, SECURITY.md, issue templates, and a PR checklist are maturity markers. They make the dependency defensible in a vendor/security review conversation and reduce "bus factor" objections — but they are documentation, not a guarantee. See the caveats below.Adopt when:
Look elsewhere — or stay on plain Collections — when:
SplFixedArray is integer-indexed and fixed-capacity by design; this is a data-shape constraint, not a missing feature, and it will not be fixed by a future release.groupBy/keyBy style reshaping) against the method reference before committing. "70+ methods" is broad, not exhaustive; treat parity as a claim to spot-check, not assume.For executives: This is a low-risk, zero-migration upgrade to an existing dependency that lets us process large datasets with a much smaller memory footprint. In practical terms that maps to fewer worker instances, fewer out-of-memory incidents in batch jobs, and faster report/export pipelines — capacity savings rather than new capability. The risk profile is unusually clean: no breaking changes, no rewrite, and the library ships with a strict static-analysis bar, full test coverage, and a published security policy. The main caveat to state plainly is that it only applies to large, uniformly-shaped numeric datasets, and it is a small open-source project with a single primary maintainer — so we should adopt it in non-critical paths first and keep it out of core transaction logic until we've validated it in production.
For engineering: Version 3.1.0 closes the parity gap with Laravel Collections — 23 new methods covering aggregation (sum, avg, min, max, reduce), conditionals (every, some, when, unless), and transformation (reject, partition, pluck, join, keys, values), plus tap/pipe for chain debugging. The filter() callback now receives $key as an optional second argument, matching Collection semantics, with no breakage to existing call sites. Performance work removed intermediate array allocations from filter() and the aggregate methods. Notably it also adds Laravel 13 support, so adopting now doesn't create a framework-upgrade blocker later. Upgrade is a composer update — no code changes required. Recommended path: pick one existing batch job or report generator with known memory pressure, benchmark it against the Collection implementation with production-shaped data, and let that result decide whether we extend adoption. Where it doesn't fit — associative arrays, dynamic sizing, string keys — keep using Collections; this is a complement to the Collection API, not a replacement for it.
How can I help you explore Laravel packages today?