laravel/helpers
Backwards-compatibility package that restores Laravel 5.8 global helper functions for newer Laravel versions. Useful when upgrading legacy apps; helpers map to modern Arr and Str methods. Not accepting new helpers.
array_add, str_limit, Html::decode, etc.). Aligns with legacy modernization and phased upgrade strategies.Arr, Str, and Html facades to proxy calls, ensuring zero breaking changes to legacy code. Ideal for monolithic applications or large codebases where refactoring is costly.Arr::add(), Str::limit()).laravel/helpers) and automatically enables legacy helpers. No manual setup or facade binding required.illuminate/support).| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Deprecation Risk | Helpers are officially deprecated in Laravel. Package may become obsolete. | Plan for phased refactoring post-upgrade; monitor Laravel’s deprecation timeline. |
| Performance Overhead | Minimal (~0% runtime impact), but indirect calls to facades may add microseconds. | Benchmark critical paths; prioritize refactoring high-traffic legacy helper usage. |
| Version Lock-In | Tied to Laravel’s helper evolution. Future Laravel versions may drop support. | Use semver constraints in composer.json to pin to stable releases. |
| Security | MIT-licensed, but relies on illuminate/support. Monitor for CVEs. |
Add dependency scanning (e.g., Snyk) to alert on vulnerabilities. |
| Maintenance Burden | Package is no longer accepting new helpers, but fixes are applied. | Treat as a temporary bridge; allocate sprints for refactoring. |
Upgrade Timeline:
Legacy Helper Usage:
array_add vs. Html::decode may have different migration paths.Refactoring Strategy:
Testing Coverage:
Dependency Management:
composer why laravel/helpers to track dependencies.Alternative Solutions:
Assessment Phase:
composer why-not laravel/helpers to check for conflicts.grep -r "array_add\|str_limit\|Html::" app/ --include="*.php"
Pilot Integration:
composer require laravel/helpers --dev
Phased Rollout:
composer.json (dev/prod).if (!class_exists('Arr')) {
class_alias('Illuminate\Support\Arr', 'Arr');
Arr::macro('legacyWarning', function () {
throw new \RuntimeException('Legacy helper detected! Refactor to Arr::add().');
});
}
str_limit) to modern equivalents.Post-Upgrade:
laravel/helpers after migrating all legacy helpers.Arr::add() instead of array_add()).| Component | Compatibility Status |
|---|---|
| Laravel 7–13 | ✅ Fully supported (tested via CI). |
| PHP 8.0–8.5 | ✅ Explicitly tested (see changelog for PHP 8.5 fixes). |
| Laravel Mix/Vite | ✅ No conflicts (helpers are server-side only). |
| Database | ⚠️ Indirect: If legacy helpers interact with queries (e.g., Arr::dot()), test thoroughly. |
| Third-Party Packages | ✅ Safe unless they override Arr, Str, or Html facades. |
| Custom Facades | ⚠️ May conflict if they extend the same facades. Check with composer dump-autoload. |
Pre-Upgrade:
laravel/helpers before upgrading Laravel to avoid breaking changes.Current: Laravel 5.8 → Install helpers → Upgrade to Laravel 12 → Refactor helpers → Remove helpers.
Post-Upgrade:
Deprecation Strategy:
Arr::macro('add', function ($array, $key, $value) {
\Log::warning("Legacy helper 'array_add' used. Refactor to Arr::add().");
return \Illuminate\Support\Arr::add($array, $key, $value);
});
illuminate/support for breaking changes (e.g., PHP 8.5+ fixes).How can I help you explore Laravel packages today?