spatie/array-functions
Handy PHP array utilities from Spatie. Adds small, focused functions in the Spatie namespace (e.g., array_rand_value to pick a random value) to complement built-in array helpers. Install via Composer and use directly in your code.
collect() and array_* functions, offering additional utility methods (e.g., array_get, array_set, array_forget, array_where, array_first).array_get/array_set in services, then expand).array_first vs. collect()->first()). Requires discipline in codebase consistency.collect() or native PHP functions? (e.g., deep array manipulation, legacy codebases).collect() evolve to include similar functionality, making this package redundant?ArrayHelper) be preferable to avoid external dependencies?collect() is slower for specific operations (benchmark first).collect() or accessors instead).composer require spatie/array-functions).array_get($request->all(), 'user.data')) in a non-critical service.ArrayHelper class as a backup for critical paths.array_first/array_last deprecations in PHP 9.x).composer.json and validate in CI (e.g., phpunit, pint).array_first vs. collect()->first()).trigger_error).^ version constraints (e.g., ^1.0) for minor updates.array_where vs. collect()->where).collect() methods.array_get()->where()).collect()->firstWhere).array_get($array, 'key.path')).array_get, array_set, array_where).collect() or native PHP. Address with:
How can I help you explore Laravel packages today?