Skip to content
Read configuration information from files that return associative arrays
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Luracast
tests
.gitignore
.travis.yml
LICENSE.txt
README.md
composer.json
composer.lock
phpunit.xml

README.md

Config

Latest Stable Version Total Downloads Latest Unstable Version License Build Status

Config class for loading configuration arrays from various files and provide easy access to nested properties with dot syntax

Lazy loads configuration information when requested using Config::get('file.property','default_value') or $config['file.property']

For example :-

Config::get('database.connections.sqlite', [])

will load database.php which returns an array that contains connections property which contains the sqlite property value of which will be returned. $path given in the constructor is the path it will look for the file. If file does not exist or the property does not exist, then the default value (set by the second parameter) will be returned.

If there is no default value, null will be returned.

When an environment string is specified, it will look for a folder with that name inside the path and use the returned array to override the properties is original config file thus allowing some customization

Setting A Configuration Value

Notice that "dot" style syntax may be used to access values in the various files. You may also set configuration values at run-time:

Config::set('database.default', 'sqlite');

Configuration values that are set at run-time are only set for the current request, and will not be carried over to subsequent requests.

You can’t perform that action at this time.