Laravel Helpers

Restores Laravel's legacy global array_* and str_* helper functions as a drop-in compatibility package.

Library
Composer
vv1.8.3
807stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
63/100Good
Development Activity60
Maintenance48
Community56
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
54/100Fair
Architecture40
Code Quality60
Innovation25
Learning Curve90

Laravel Helpers exists for one reason: Laravel 9 removed dozens of global helper functions (array_add, array_collapse, str_slug, str_random, and dozens more) that Laravel 5.8-era applications depended on, moving that functionality onto the Arr and Str classes instead. This package brings those global functions back verbatim, each one a thin wrapper delegating to the modern Illuminate\Support\Arr/Illuminate\Support\Str methods, so older codebases (or packages still calling the old function names) keep working after upgrading Laravel.

It’s explicitly a compatibility shim, not an actively growing helper library — the README states plainly that the maintainers are “not accepting new helpers.” You install it once during a Laravel upgrade to avoid a mass find-and-replace of helper calls, then either migrate off it at your own pace or leave it installed indefinitely since it adds negligible overhead.

What You Get

  • 42 global helper functions (array_add, array_collapse, array_divide, array_first, array_flatten, str_slug, str_random, str_plural, str_singular, and more) restored exactly as they behaved pre-Laravel-9
  • Each function wraps the equivalent Illuminate\Support\Arr or Illuminate\Support\Str static method, so behavior stays in sync with the underlying Laravel version installed
  • function_exists() guards around every definition, so the package is safe to install alongside code that may already define some of these names
  • Compatibility across a wide Laravel version range (illuminate/support ~5.8 through 13.x), letting it bridge multiple major-version upgrades

Common Use Cases

  • Upgrading a Laravel 5.8/6.x/7.x/8.x application to Laravel 9+ without immediately rewriting every array_get()/str_slug() call site to the Arr/Str equivalents
  • Third-party Laravel packages that haven’t updated their internal helper calls yet and need the old global functions present to avoid fatal errors
  • Legacy codebases with many scattered helper calls where a full migration to Arr::/Str:: syntax is planned but not immediate
  • Temporary compatibility bridging during a phased Laravel upgrade, later removed once all call sites are migrated to the class-based API

Under The Hood

Architecture — The entire package is one file, src/helpers.php (644 lines), loaded via Composer’s files autoload mechanism (not PSR-4 classes) so the functions become globally available the moment the package is installed. Each function is wrapped in an if (! function_exists(...)) guard and its body is a one-line delegation to the corresponding Arr:: or Str:: static method — no independent logic is reimplemented, it’s purely a naming-compatibility layer over illuminate/support. Tech Stack — Pure PHP (^7.2 || ^8.0) with a single runtime dependency, illuminate/support, spanning an unusually wide compatibility range (~5.8.0 through ^13.0) to support upgrades across many Laravel major versions. Dev tooling is PHPStan and PHPUnit across a similarly wide version range. Code Quality — A single test file exercises the helper functions; given each function is a one-line delegation to a well-tested upstream class, the coverage burden is low. The codebase is intentionally frozen in scope (README: “we are not accepting new helpers”) — commit activity is about keeping compatibility as new Laravel majors ship, not adding functionality. API Design — There is no API design in the conventional sense: the entire point is that the API is the old Laravel global function signatures, preserved byte-for-byte so calling code needs zero changes. This makes adoption maximally frictionless — installing the package and requiring nothing else is often the entire integration.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search