- How does `laravel/helpers` work with Laravel 10+? Does it break anything?
- The package acts as a compatibility layer, intercepting deprecated helper calls (e.g., `array_add`) and redirecting them to modern equivalents like `Arr::add`. It requires zero code changes and won’t break existing functionality. However, it’s temporary—plan to refactor legacy helpers post-upgrade.
- Can I use this package to upgrade from Laravel 5.8 to 13 without rewriting all helper calls?
- Yes. The package restores 5.8 helpers (e.g., `str_limit`, `Arr::dot`) for newer Laravel versions, letting you upgrade incrementally. It’s ideal for large codebases where rewriting helpers would be time-consuming. Just install it via Composer and continue using legacy helpers.
- Will this package slow down my Laravel app?
- No. The package uses direct method redirection with negligible overhead (~0% runtime cost). It’s designed for performance-critical applications and won’t introduce bottlenecks. Benchmark your app post-installation to confirm.
- Does `laravel/helpers` support custom helper extensions (e.g., `Helper::customMethod`)?
- No. This package only supports Laravel’s built-in 5.8 helpers (e.g., `array_add`, `Html::decode`). Custom helper extensions won’t work unless they rely on the same deprecated internals. For custom logic, refactor to modern Laravel features like Collections or Str/Arr methods.
- What Laravel versions does this package support?
- The package works with Laravel 7 through 13 (as of v1.8.3) and PHP 8.0–8.5. It’s designed for multi-version environments or staged upgrades. Check the [GitHub repo](https://github.com/laravel/helpers) for the latest compatibility matrix.
- How do I test if the modern equivalents (e.g., `Arr::add`) behave the same as legacy helpers?
- Run differential tests comparing legacy and modern helper outputs for edge cases (e.g., nested arrays, null values). The package doesn’t guarantee identical behavior—some helpers may have subtle differences. Log warnings when legacy helpers are used to prioritize testing.
- Can I use this package alongside third-party packages that depend on Laravel 5.8 helpers?
- Yes, but verify the third-party packages don’t rely on internals this package doesn’t support. If they do, check their upgrade paths or contact their maintainers. This package only handles Laravel’s core 5.8 helpers, not custom or package-specific ones.
- What’s the best way to migrate away from this package after upgrading?
- Start by logging warnings when legacy helpers are used (e.g., via a custom facade). Gradually replace them with modern equivalents (e.g., `Arr::add` instead of `array_add`) in sprints. Use Laravel’s IDE helper or `php artisan ide-helper:generate` to ensure autocompletion works during refactoring.
- Does this package work with Laravel’s first-party packages (e.g., Nova, Forge, Envoyer)?
- Yes, but only for core helper compatibility. First-party packages may have their own upgrade paths or dependencies. Test thoroughly, as some packages might rely on deprecated internals this package doesn’t cover. Check their release notes for guidance.
- Are there alternatives to `laravel/helpers` for backward compatibility?
- For Laravel 5.8 helpers, this is the official solution. For broader backward compatibility (e.g., Eloquent, Blade), consider `laravel/legacy-factories` or custom facades. However, no package matches this one’s precision for 5.8 helpers. Always weigh the trade-off between temporary compatibility and long-term refactoring.