Lightweight library for collecting and merging configuration from different sources

1.7.0 2021-10-26 10:59 UTC

This package is auto-updated.

Last update: 2021-12-26 11:19:56 UTC


Build Status

Aggregates and merges configuration, from a variety of formats. Supports caching for fast bootstrap in production environments.


The standalone ConfigAggregator can be used to merge PHP-based configuration files:

use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ConfigAggregator\PhpFileProvider;

$aggregator = new ConfigAggregator([
    new PhpFileProvider('*.global.php'),


Using this provider, each file should return a PHP array:

return [
    'db' => [
        'dsn' => 'mysql:...',

return [
    'cache_storage' => 'redis',
    'redis' => [ ... ],


array(3) {
  'db' =>
  array(1) {
    'dsn' =>
    string(9) "mysql:..."
  'cache_storage' =>
  string(5) "redis"
  'redis' =>
  array(0) {

Configuration is merged in the same order as it is passed, with later entries having precedence.

Together with laminas-config, laminas-config-aggregator can be also used to load configuration in different formats, including YAML, JSON, XML, or INI:

use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ConfigAggregator\LaminasConfigProvider;

$aggregator = new ConfigAggregator([
    new LaminasConfigProvider('config/*.{json,yaml,php}'),

For more details, please refer to the documentation.