Provides an extension to the laminas/laminas-config-aggregator
to allow parameters within your configuration.
use Laminas\ConfigAggregator\ArrayProvider;
use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ConfigAggregatorParameters\ParameterPostProcessor;
$aggregator = new ConfigAggregator(
[
new ArrayProvider([
'parameter_usage' => '%foo%',
'parameter_name' => '%%foo%%',
'recursive_parameter_usage' => '%bar.baz%',
'parameterized_parameter_usage' => '%bar.quux%',
]),
],
null,
[
new ParameterPostProcessor([
'foo' => 'bar',
'bar' => [
'baz' => 'qoo',
'quux' => '%foo%',
],
]),
]
);
var_dump($aggregator->getMergedConfig());
Result:
array(5) {
'parameter_usage' =>
string(3) "bar"
'parameter_name' =>
string(5) "%foo%"
'recursive_parameter_usage' =>
string(3) "qoo"
'parameterized_parameter_usage' =>
string(3) "bar"
'parameters' =>
array(4) {
'foo' =>
string(3) "bar"
'bar' =>
array(2) {
'baz' =>
string(3) "qoo"
'quux' =>
string(3) "bar"
}
'bar.baz' =>
string(3) "qoo"
'bar.quux' =>
string(3) "bar"
}
}
For more details, please refer to the documentation.
- File issues at https://github.com/laminas/laminas-config-aggregator-parameters/issues
- Documentation is at https://docs.laminas.dev/laminas-config-aggregator-parameters/