danyal14's avatar

Lumen config folder is missing

Hi,

I know Lumen doesn't include config folder in framework but in vendors. My question is how can I define custom env variables as I used to do in Laravel.

I used to define new custom config key in config/app.php, then to set in .env file all worked.

But in Lumen I don't see this happening.

Another thing if I can create my own config file to define Company/App related env vars.

/Regards

0 likes
2 replies
manelgavalda's avatar

You need to create the config files and load the configuration yourself. If you want to create the config files inside the config folder like laravel, then you can add this in your bootstrap.php (or you can also create your own configuration provider):

collect(scandir(__DIR__ . '/../config'))->each(function ($item) use ($app) {
    $app->configure(basename($item, '.php'));
});

Then you can use this configuration as normal:

config('configfile.test');

The answer was taken from here: https://github.com/laravel/lumen-framework/issues/107#issuecomment-435608448

4 likes

Please or to participate in this conversation.