Download the PHP package bhuvidya/laravel-helper-loader without Composer
On this page you can find all versions of the php package bhuvidya/laravel-helper-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bhuvidya/laravel-helper-loader
More information about bhuvidya/laravel-helper-loader
Files in bhuvidya/laravel-helper-loader
Package laravel-helper-loader
Short Description Load multiple helpers from a source directory, providing support for them to be concatenated into a cache file in the bootstrap/cache directory.
License MIT
Homepage https://github.com/bhuvidya/laravel-helper-loader
Informations about the package laravel-helper-loader
Laravel Helper Loader
Note I have now switched the semver versioning for my Laravel packages to "match" the latest supported Laravel version.
Laravel Helper Loader is a package that will load multiple, custom "helper" modules from a given path. This allows you to separate your custom helper functions into different php files. You can also cache multiple helper files into one, quick to load file, a la Laravel "config".
Installation
Add bhuvidya/laravel-helper-loader
to your app:
$ composer require "bhuvidya/laravel-helper-loader"
If you're using Laravel 5.5 or above, you don't have to edit app/config/app.php
.
Otherwise, edit app/config/app.php
and add the service provider:
'providers' => [
'BhuVidya\HelperLoader\HelperLoaderServiceProvider',
]
Configuration
The configuration file specifies the path to your helper files (default APP_ROOT/helpers
), and
the cache file (default APP_ROOT/bootstrap/cache/helpers.php
).
You can manage and customise the configuration by installing the default config file:
The following config file will be published in config/helper_loader.php
:
Alternately, you can set the Helper Loader config vars by using your .env
file. As you can
see above, the env variables used are:
Usage
So once your helpers path is set, you can freely add and edit helper modules to that path, and they will be loaded automatically for you. For a production environment, you may want to cache your helper files. You can do this in a way similar to caching your config files:
If the helper loader cache file exists, it is always loaded, even if you have updated or added to your helper modules. You can clear the cache file as follows:
Credits
- bhu Boue vidya
- All Contributors
License
MIT