- How do I install petrobolos/fixed-array-functions in a Laravel app?
- Install it with Composer using composer require petrobolos/fixed-array-functions. The package requires PHP 8.4 and exposes a global fixedArray() helper, so no service provider, config file, or migration is needed. Once Composer autoloading is in place, you can call fixedArray() in your application code.
- Does petrobolos/fixed-array-functions work outside Laravel?
- The package is described as Laravel helper methods, but it has no service provider, config surface, persistence, or I/O, so integration is mostly Composer plus the fixedArray() helper. The key open question is whether it hard-depends on illuminate/support or only lists Laravel in its CI matrix. Confirm that dependency before using it in non-Laravel PHP services.
- What PHP and Laravel versions does fixed-array-functions support?
- The package requires PHP 8.4, so that is the hard minimum for adoption. The assessment notes a claimed Laravel 10 through 13 compatibility matrix, but that is a CI claim rather than a contractual guarantee. Verify against your exact Laravel and PHP patch versions before rolling it into a production application.
- Is petrobolos/fixed-array-functions a drop-in replacement for Laravel Collection?
- It provides a fluent, Collection-compatible API over SplFixedArray, but it is not a drop-in replacement at the type level. Return values are not Illuminate\Support\Collection, so type hints, return declarations, paginators, and lazy or generator behavior expecting Collection will fail. Use it behind an internal adapter or on a narrow hot path rather than replacing collect() broadly.
- Is fixed-array-functions faster or more memory-efficient than native PHP arrays?
- SplFixedArray can reduce memory overhead for large numeric payloads because it avoids normal PHP hash-table behavior and has a fixed size. It is not automatically faster for every workload, and code paths that append will pay resize costs that can erase the memory win. Benchmark your actual sizes, such as 100k and 1M rows, for sum, avg, filter, map, and pluck chains against native arrays and Collection.
- What changed in the filter() method in fixed-array-functions 3.1?
- In version 3.1, filter() now passes both value and key to the callback instead of only the value. That is backward compatible for closures and most callables, but it is a behavioral change for callables that introspect arguments with func_get_args or variadics. Because it shipped in a minor release, test any callback that depends on argument count before upgrading.
- Can I use petrobolos/fixed-array-functions in production?
- It is reasonable for leaf, in-process hot paths such as report aggregation, exports, or large numeric transforms in queue workers. The quality signals are strong for its size: 290 tests, a 100% coverage claim, PHPStan Level 9, active Dependabot, and governance files. Still, run a parity harness over the methods you actually call, wrap usage in an adapter, and feature-flag each migrated path so rollback is a one-line change.
- Do when(), unless(), and tap() return the same instance in fixed-array-functions?
- The provided assessment flags mutation and aliasing semantics for when(), unless(), tap(), and pipe() as unverified. Whether those methods return the same instance or a clone determines whether long fluent chains can introduce aliasing bugs. Add explicit identity and mutation tests before relying on them, and prefer clear assignment over very long chains.
- How does fixed-array-functions handle JSON, toArray(), and Eloquent models?
- Serialization behavior for json_encode, nested toArray() calls, and Eloquent models as elements is flagged as needing verification. SplFixedArray is not a native PHP array, so do not assume JSON or array conversion matches Laravel Collection exactly. Test with your real payloads and convert to native arrays at application boundaries where interoperability matters.
- Who maintains petrobolos/fixed-array-functions and is it safe long term?
- The bus factor is effectively one maintainer, which is tolerable for a leaf library behind an adapter but risky across many files. The project has good signals such as tests, static analysis, Dependabot, and newer contribution and security files, but you should verify release cadence, response time, patch acceptance, and adoption. Also resolve the provenance gap between the Composer name petrobolos and the GitHub org oliverearl before it clears supply-chain review.