aviator/array-map-keys
A small PHP utility for transforming array keys throughout nested arrays. Pass a callback to map every key, including helpers for common conversions like snake_case to camelCase. Handy for normalizing config arrays or API payloads before processing.
composer.json is a permanent line item in every future security audit, PHP-version upgrade, and framework migration. A PM should treat that as a cost with no corresponding upside.Arr::map($array, fn ($value, $key) => ...) and collect($array)->map(fn ($value, $key) => ...) cover this exactly. Adopting a third-party micro-utility here signals a gap in team knowledge of the framework, not a gap in the framework — which is a documentation and onboarding decision, not a procurement one.Consider it only under a narrow, largely historical set of conditions:
Arr::map does not exist and pulling in illuminate/collections is undesirable.Look elsewhere — meaning: use native framework features or write the helper — in every other case. Specifically:
illuminate/collections: use Arr::map or Collection::map. Zero new dependencies, first-party support, documented behavior.foreach with key/value, array_walk, or array_reduce are clearer to most readers than an unfamiliar package name in the use block.The low opportunity score is itself the signal: there is no unmet market need here, because the ecosystem already closed this gap.
To executives: We evaluated a small open-source utility for mapping over arrays with key access. Recommendation: do not adopt. It provides a trivial convenience already available in our framework, but would add an unmaintained, single-maintainer dependency to our supply chain that we would carry through every future upgrade and security review. The cost is small but permanent; the benefit is zero. No roadmap impact.
To engineering: Use Arr::map or collect()->map() — both pass $value, $key to the callback — or add a small namespaced helper to our internal utilities package if we need this outside a Laravel context. Avoid adding a 2017-era package with three stars for behavior we can express in one line. If a legacy service on Laravel 8 or earlier genuinely cannot use Arr::map, prefer a local helper over a new dependency; if a dependency is mandated by policy, pin it and record why in an ADR.
To security and platform teams: Flagged and rejected. Last release 2017, no dependents, no security disclosure process, MIT-licensed and therefore forkable if we ever truly needed it — which we do not.
How can I help you explore Laravel packages today?