The config class provides some functions to work with config files.
You can store your own config files in the config folder and you can load your customized configuration in your app.
Here is a list of available public methods for this class:
This method load the given config file and return it as object.
Static | Yes | |||
Parameters | Parameter | Type | Default | Description |
$file | String | Name of config file. Example: 'config'. | ||
$extension | String | json | Extension of given config file. Example: 'json'. |
Config::load('config');
This method get value from given file / item file.
If no $item is given, the whole config file will be returned as object.
Static | Yes | |||
Parameters | Parameter | Type | Default | Description |
$file | String | Name of config file. Example: 'config'. | ||
$item | String | null | The name of the item to retrieve. Multi-dimensional arrays can be accessed by separating the levels by a dot ".". | |
$default | String | null | If given item is not found, the default value will be returned. | |
$extension | String | json | Extension of given config file. Example: 'json'. |
var_dump(Config::get('config', 'project.name'));
// Output: string(17) "LightPHPFramework"