- How do I install and set up Laravel Dynamic Helpers in a Laravel 12 project?
- Run `composer require l0n3ly/laravel-dynamic-helpers`—the package auto-discovers the service provider, so no manual registration is needed. Create your first helper with `php artisan make:helper HelperName` and use it immediately via global functions like `helperName()`.
- Can I use nested helpers (e.g., `Store/ProductHelper`) in subdirectories?
- Yes, place helpers in nested directories like `app/Helpers/Store/ProductHelper.php`. The package automatically converts paths to camelCase global functions (e.g., `storeProductHelper()`), mirroring Laravel’s nested service provider structure.
- Does this package work with Laravel 10? The README says it supports 11–13.
- No, Laravel 10 support was dropped in v1.3.0. If you’re on Laravel 10, downgrade to v1.2.x or migrate to Laravel 11+. The package provides a smooth upgrade path with auto-discovery replacing manual registration.
- How secure is dynamic helper generation with `eval()`? Can I restrict helper creation?
- The package uses `eval()` internally for performance, but helper classes are resolved from trusted `app/Helpers` directories. Restrict access to the `make:helper` command via Laravel’s authorization (e.g., gates/policies) or team workflows. Always validate helper class names and methods manually.
- Will auto-generated IDE files (_ide_helper.php, .phpstorm.meta.php) work in VSCode or other IDEs?
- The package generates IDE files compatible with PhpStorm and VSCode. These files must be committed to version control (not ignored) for CI/CD environments. VSCode’s PHP Intelephense extension will recognize the global helper functions automatically.
- What’s the performance impact of dynamic helper resolution in large apps (100+ helpers)?
- Dynamic resolution adds minimal boot-time overhead (~50–100ms for 100 helpers on average hardware). Helpers are cached as singletons, so repeated calls are fast. Benchmark in staging if performance is critical—lazy-loading is planned for future versions.
- Can I customize helper naming conventions (e.g., snake_case instead of camelCase)?
- Currently, the package uses camelCase for global functions (e.g., `moneyHelper()`). Customization isn’t natively supported, but you could extend the base `Helper` class or override the `getFunctionName()` method in your service provider for alternative naming schemes.
- How do I test helpers in CI/CD? Can I mock singletons for unit tests?
- Helpers are singletons, so mock them in tests using Laravel’s `Mockery` or PHPUnit’s `createMock()`. For integration tests, use the global functions directly. The package doesn’t include built-in testing utilities, but its singleton pattern aligns with standard Laravel testing practices.
- Are there alternatives to Laravel Dynamic Helpers for managing reusable code?
- Alternatives include static helper classes (manual registration), Laravel’s built-in `app/Helpers` with `use` statements, or packages like `spatie/laravel-helper`. This package stands out with dynamic resolution, Artisan generation, and IDE support—ideal for teams needing global functions without manual setup.
- How does the package handle future Laravel versions (e.g., Laravel 14)? What’s the deprecation policy?
- The package follows Laravel’s release cycle and drops support for versions older than LTS (e.g., Laravel 11 may be deprecated after Laravel 15’s release). Check the [GitHub releases](https://github.com/idehen-divine/laravel-dynamic-helpers/releases) for version-specific notes. Backward compatibility is prioritized for major Laravel updates.