Download the PHP package donsimon/alt-brite-config without Composer
On this page you can find all versions of the php package donsimon/alt-brite-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donsimon/alt-brite-config
More information about donsimon/alt-brite-config
Files in donsimon/alt-brite-config
Package alt-brite-config
Short Description A simple PHP INI (or plain array) configuration class with dot-notation access
License MIT
Homepage https://github.com/chathurasudarsha/alt-brite-config
Informations about the package alt-brite-config
Brite Config
A simple PHP INI (or plain array) configuration class with dot-notation access
- Parses both INI files and PHP arrays
- Deals allows for configuration inheritance
- Available via Composer / Packagist
Usage
You need a configuration file. Example .ini
contents:
[default]
database.host = bar
database.user = foo
database.pass = baz
service.api_key = 123456
email = [email protected]
[staging:default]
database.user = foo2
database.pass = baz2
[production:staging]
database.user = foo1
database.pass = baz1
email = [email protected]
Or alternatively, if you prefer plain PHP arrays:
If you want to use the 'registry', register your configuration file during bootstrap:
Then access your configuration when required:
Alternatively, if you have multiple configuration files, you may name your configuration something other than 'default' during bootstrap, and access it via:
However, we all know that global access is bad, right? You can create your own instance to contain your configuration, rather than using a global static registry:
... and that's it. Simple!