laravel/helpers
Backwards compatibility layer restoring Laravel 5.8's global helper functions—array, string, and URL helpers—in newer Laravel releases. Install with Composer; new helpers are not accepted. Modern equivalents are available as static methods on the Arr and Str classes for older codebases.
laravel/helpers converts a "big bang" Laravel 5.8→current migration into two independently shippable releases: (1) framework bump + add this package, fix only genuine breaking changes; (2) a later, schedulable helper-refactor PR that removes it. This is a roadmap decision, not a coding one — it lets you place the upgrade in a sprint without also funding a mechanical cleanup sprint in the same window.if (! function_exists(...)) shims forwarding to Arr::/Str::), but you should buy: it is first-party Laravel, MIT, and its illuminate/support constraint is bumped ahead of each framework release (through ^13.0 in v1.8.3), which is the maintenance burden you actually want to avoid. Building your own means owning that version-matrix upkeep forever.array_get / str_slug / studly_case etc. turns "modernization" into a number — that number decides whether the refactor is a two-day sweep or genuine rework, and therefore whether it's a sprint line item or a background task.array_get and cannot be patched. This is a ship-blocker you can resolve in one composer require rather than a fork-and-maintain decision.array_get→Arr::get, str_limit→Str::limit), golden tests pinning the helpers whose legacy and modern behavior are not byte-identical (dot-notation array_get, non-ASCII str_slug), then removal. That plan is a deliverable, not an afterthought — otherwise "temporary" becomes permanent.Adopt when all of these hold:
illuminate/support constraint (verify with composer show laravel/helpers; v1.8.3 covers ^13.0, v1.7.2 covers Laravel 12). If the range doesn't overlap your framework, bump the package tag rather than forcing the constraint.require, not require-dev, if any production code path calls a helper — and that long-lived workers (Horizon, queue) need a restart after install.Look elsewhere — or skip entirely — when:
Arr:: / Str:: / Str::of() directly.Str fluent API._ide_helper file for the transition period. That's small but real work.To executives: This is a one-line dependency that de-risks and de-scopes a platform upgrade. Instead of a single risky release that changes both the framework and hundreds of code call sites, we split it: the framework upgrade ships first with laravel/helpers installed, and the code cleanup becomes a separately scheduled, measurable piece of work we can size before committing to it. It's first-party Laravel code, MIT-licensed, actively version-bumped ahead of each framework release, and reversible — removing it is a composer remove once call counts hit zero. Total cost is near zero; the alternative is either a larger, riskier upgrade PR or forking a vendor package we don't control.
To engineering: Zero-config — Composer files autoload, no service provider, no config, no publishing. It re-registers the 5.8 global helpers and each one simply forwards to Arr:: / Str::. Three rules: put it in require (not require-dev), restart queue workers after install, and freeze new usage with a CI baseline or a PHPStan/PHP-CS-Fixer banned-function rule so the count only goes down. Convert per-file rather than per-helper-name to keep diffs reviewable, automate the bulk with Rector, and pin the handful of non-identical behaviors (array_get dot notation, str_slug with non-ASCII) in tests before deleting the package. Where unmodifiable vendor code forces the dependency, document which package and why in composer.json or a tech-debt note so nobody rips it out and breaks production.
Risk statement to include in the pitch: the API is frozen ("We are not accepting new helpers") and behavior is inherited from Arr/Str with no patches — this is a compatibility bridge with a planned exit, not a strategic dependency. Adopt it with a named owner and a removal criterion, not indefinitely.
How can I help you explore Laravel packages today?