Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Dynamic Helpers

Laravel Dynamic Helpers Laravel Package

l0n3ly/laravel-dynamic-helpers

Laravel package for managing custom helper classes dynamically. Generate helpers with php artisan make:helper, organize them in nested folders, and call them as global functions like moneyHelper() with auto-registration and singleton caching.

View on GitHub
Deep Wiki
Context7

Laravel Dynamic Helpers provides a lightweight helper management system that resolves custom helper classes on demand through a singleton-backed container. Generate helpers instantly with php artisan make:helper, organize them in nested directories, and call them as real global functions like moneyHelper()->format(1000) with full IDE autocomplete.

  • 🚀 Dynamic resolution with instance caching for performance
  • 🎯 Artisan generator via php artisan make:helper
  • 📁 Nested helpers such as Store/CreateHelper
  • 🔌 Auto-discovery and boot-time function registration
  • 💡 Direct global access alongside the helpers() function

Requires PHP 8.1+ and Laravel 11+.

Frequently asked questions about Laravel Dynamic Helpers
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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin