laminas/laminas-config-aggregator-modulemanager

Consume laminas-mvc modules as configuration providers within laminas-config-aggregator.

1.3.0 2021-12-06 02:15 UTC

This package is auto-updated.

Last update: 2021-12-06 02:16:06 UTC


README

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee. If you have a security issue, please follow our security reporting guidelines. If you wish to take on the role of maintainer, please nominate yourself

Build Status

Provides an extension to the laminas/laminas-config-aggregator so laminas/laminas-mvc modules can be parsed into the new config structure, e.g. for mezzio/mezzio or other projects.

Usage

use Laminas\ConfigAggregator\ConfigAggregator;
use Laminas\ConfigAggregatorModuleManager\LaminasModuleProvider;
use My\Laminas\MvcModule\Module as MyLaminasMvcModule;

namespace My\Laminas\MvcModule
{
    class Module
    {
        public function getConfig()
        {
            return [
                'service_manager' => [
                    'invokables' => [
                        Service\MyService::class => Service\MyService::class,
                    ],
                ],
            ];
        }
    }
}

namespace My\Laminas\MvcModule\Service {
    class MyService
    {
    }
}

$aggregator = new ConfigAggregator([
    new LaminasModuleProvider(new MyLaminasMvcModule()),
]);

var_dump($aggregator->getMergedConfig());

Using this provider, the Module class is being parsed for laminas/laminas-modulemanager interfaces or methods. Just the same way as laminas/laminas-mvc does. Therefore, the output of the example would be:

array(1) {
  'dependencies' =>
  array(1) {
    'invokables' =>
    array(1) {
       'My\Laminas\MvcModule\Service\MyService' =>
       string(35) "My\Laminas\MvcModule\Service\MyService"
    }
  }
}

For more details, please refer to the documentation.