X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fconsolidation%2Fconfig%2FREADME.md;h=7108cd6ec02fb76b813bf2e874a8b073f15faeb7;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=7fdf11fc92822c4613d102ab168ffbcf70b28fc1;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252;p=yaffs-website diff --git a/vendor/consolidation/config/README.md b/vendor/consolidation/config/README.md index 7fdf11fc9..7108cd6ec 100644 --- a/vendor/consolidation/config/README.md +++ b/vendor/consolidation/config/README.md @@ -131,6 +131,7 @@ $application->setDispatcher($eventDispatcher); ### Get Configuration Values + If you have a configuration file that looks like this: ``` a: @@ -143,6 +144,19 @@ $value = $config->get('a.b.c'); ``` [dflydev/dot-access-data](https://github.com/dflydev/dot-access-data) is leveraged to provide this capability. +### Interpolation + +Interpolation allows configuration values to be injected into a string with tokens. The tokens are used as keys that are looked up in the config object; the resulting configuration values will be used to replace the tokens in the provided string. + +For example, using the same configuration file shown above: +``` +$result = $config->interpolate('The value is: {{a.b.c}}') +``` +In this example, the `$result` string would be: +``` +The value is: foo +``` + ### Configuration Overlays Optionally, you may use the ConfigOverlay class to combine multiple configuration objects implamenting ConfigInterface into a single, prioritized configuration object. It is not necessary to use a configuration overlay; if your only goal is to merge configuration from multiple files, you may follow the example above to extend a processor with multiple configuration files, and then import the result into a single configuration object. This will cause newer configuration items to overwrite any existing values stored under the same key.