Download the PHP package userfrosting/config without Composer
On this page you can find all versions of the php package userfrosting/config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download userfrosting/config
More information about userfrosting/config
Files in userfrosting/config
Package config
Short Description Configuration module for UserFrosting
License MIT
Homepage https://github.com/userfrosting/config
Informations about the package config
Config module for UserFrosting 4
| Branch | Build | Coverage | Style |
|---|---|---|---|
| master | |||
| develop | |
Usage
Create a file default.php, in a directory /path/to/core/config/:
default.php
Suppose now you have another config file which can override values in this base config file. For example, in /path/to/plugin/config/, you have:
default.php
You can generate an ordered list of these configuration files using the ConfigPathBuilder class, and merge them together using an instance of UserFrosting\Support\Respository\Loader\ArrayFileLoader.
Path builder
Create ResourceLocator and ConfigPathBuilder classes to build a list of configuration files:
Data loader
You can then use the ArrayFileLoader class to load and merge all configuration data from this list of paths:
Config files in multiple paths will be merged in the order in which the paths are specified. You can now access your configuration data via the standard Repository methods:
You can also specify environment-specific config files in each path. If an environment name is passed to buildPaths(), ConfigPathBuilder will merge in the environment-specific file in a path immediately after merging in default.php:
development.php
To merge this in, you would call: