extends
BrObjectHelper to work with configuration settings. We suggest to put all your settings into set of config files in the root folder of your project. Good practice is to separate DB settings, project settings and Bright settings. This allow you to exclude DB configs from your version control if you are using it for deploying.
There is one global config object (singleton) accessible via br()->config()
. You can still create own configuration storage if required by $config = new BrConfig();
Method/property | Description |
---|---|
If you are using global config, please prepend below methods with br()->config()-> |
|
set(name, value) | Set configration value. Value could be scalar or array. |
get() | Get all configuration values |
get(name, defaultValue) | Get configuration value or default value for this setting. Name could be array path. For example: br()->config()->set('SomeStructuredSetting', array('name' => 'SomeName')); echo(br()->config()->get('SomeStructuredSetting.name')); Output: SomeName |
Again, if you are working with global config object you can use br()->config(name, defaultValue)
instead of br()->config()->get(name, defaultValue)
for simplicity.