All configuration files are located in your application/configs folder. By default, framework needs these configs in your configs folder:

configs/application.php - paths, environment, log and class aliases
configs/cache.php - cache drivers and their options
configs/database.php - database drivers and their options
configs/mail.php - mail drivers and their options
configs/session.php - session options

All config files should return the associative array of values.

Example of config file

<?php /* Lets assume this file is named configs/site.php */

return array(
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'key4' => 'value4'

Fetching values from config

Fetching should be always performed using Application::getConfig() method. That method accepts two parameters from which both of them are optional. If you don't pass anything, then you'll get the whole array from configs/application.php.

If you want to get the array from the example above, then run this:


If you want to get value of key1 from the example above, then run:

echo Application::getConfig('site''key1'); // prints "value1"

Once you fetch the config, it will be stored in Application class so next time you fetch it, it will be taken from request scope and not again from file. That means that you can freely run Application::getConfig() as many times as you want.

Reloading config

If you're running long jobs with this framework (such as jobs in CLI), then you might have a need to reload config that was already loaded into memory. In that case, please run:


And then run Application::getConfig() again.

You'll probably never need this on normal HTTP requests.

Making your own config file

Please don't mix your own config into config files that are needed by the framework. Instead, create your own config file.

So, to create your own config, make file named your-config-name.php, save it in your application/configs folder and make sure that this file returns array by the example above.

After you created your config file, you'll be able to run Application::getConfig('your-config-name') from anywhere.

How Framework WorksProject Structure