Final Class Yiisoft\Config\Modifier\ReverseMerge
| Inheritance | Yiisoft\Config\Modifier\ReverseMerge |
|---|
Result of reverse merge is being ordered descending by data source. It is useful for merging module config with base config where more specific config (i.e. module's) has more priority.
The modifier should be specified as
ReverseMerge::groups('events', 'events-web', 'events-console')
For example:
- configuration in application
composer.json:
"config-plugin": {
"events": "events.php",
"params": "params.php",
}
- application
events.phpcontents:
return ['a' => 1, 'b' => 2];
- configuration in vendor package:
"config-plugin": {
"events": "events.php",
}
- vendor package
events.phpcontents:
return ['c' => 3, 'd' => 4];
- getting configuration:
$config = new Config(new ConfigPaths($configsDir), null, [
ReverseMerge::groups('events'),
]);
$result = $config->get('events');
The result will be:
[
'a' => 1,
'b' => 2,
'c' => 3,
'd' => 4,
]
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getGroups() | Yiisoft\Config\Modifier\ReverseMerge | |
| groups() | Yiisoft\Config\Modifier\ReverseMerge |
Signup or Login in order to comment.