I made a package for a better experience, you can find it here.
Load your Lumen configuration files painless using the Service Providers
.
Lumen does support custom configuration files, but they need to be enabled first.
You need to call $app->configure('file.php')
in your bootstrap/app.php
file to enable them.
So if you have a lot of config
files you must add another line indicating the config file name and this method will be a little messy.
Just download the ConfigServiceProvider
file, put it on the App\Providers
folder and add the following line in your bootstrap/app.php
file to register the provider and that's all, you are ready to go:
$app->register(App\Providers\ConfigServiceProvider::class);
The ConfigServiceProvider
automatically search and validates if the config folder exists and map all the files in it, then will register all the folder configuration files, if the folder does not exists is throwing a FileNotFoundException
.
thanks, its saved my life