Download the PHP package earthit/config-loader without Composer
On this page you can find all versions of the php package earthit/config-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download earthit/config-loader
More information about earthit/config-loader
Files in earthit/config-loader
Package config-loader
Short Description Gives access to structured config values in files or environment variables
License MIT
Informations about the package config-loader
PHP Config Loader
Gives access to structured configuration variables stored in JSON files and/or environment variables.
Example
Let's say looks like:
And we're going to run our PHP script with these environment variables:
And then we have a script like:
Would output something like:
Overrides
Variables are merged in the following order, with later steps 'overriding' the values from earlier steps:
- JSON files
- files in subdirectories (e.g. 'foo/bar.json' can override 'bar' from 'foo.json')
- JSON-encoded environment variables
- Leaf environment variables
If an array value overrides another array value, they are merged instead of replacing the old one.
Environment variable names
-
Underscores have special meaning, so if you have a variable , it's going to show up when fetched from the ConfigLoader as
- The postfix also has special meaning. It means that the value of the variable named by the part before "_json" will be determined by JSON-decoding this environment variable's value.