30 Jun

[php] Lumen Framework Additional Configuration File

lumen framework logo

Today I was interested in Lumen Framework, another product from Taylor Otwell under the Laravel flag. at my first though, oh look another laravel with less batery included by default.

started to construct new project, and yeah, I need an additional configuration file and I would like to add it somewhere separated from the famous ‘.env’ file.

after lurking around the Lumen’s docs, I found this:

whoa whoa, where this config come from? nah, found it under the this file pointing to Container’s instance. and the I found this function that can be called from the $app->configure() . This magic give you an ability to add additional configuration file using php format that placed in the config folder within your project root.

 

so, without wasting more time, I create the config folder, put my site.php file with following value:

and add this line to app.php

this method fill register your additional configuration file which is placed in config/{name}.php and you can access it later with config("{name}.{key}") . please make sure you change the {name} with correct file.

 

Fin.

Leave a Reply

Your email address will not be published. Required fields are marked *