How to access values from a configuration file stored in subdirectory?

app-config, laravel, laravel-4, subdirectory

Solution

A solution to your problem that works for me is:

Config::get('subdir/file.key');

Did you try this one yet or are you looking for more complex method?

Problem

Accessing config values at run-time in Laravel 4 is done using its Config class: ``` Config::get('app.timezone'); ``` To organize the config files, I'd like to put them into different sub-directories. For example: - `/config/users/` -> for user specific configuration - `/config/auth/` -> authentication related - and so on... I read an elder Tutorial (Laravel v3) from Dayle Rees him stating that it's possible with the following: ``` $option = Config::get('ourconfig.sub.directory.size'); ``` Tried it out with no luck. According to Jason Lewis it was never supported. Then I've had a look at the Laravel 4 API and found load() and getRequire() (more related functions can be found here). However, I couldn't find a way to grab sub-dir config values in L4. So, - Is this possible with Laravel 4? - …and, if so, how?

Original source