Consume zend-mvc modules as configuration providers within zend-config-aggregator.
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
src
test
.coveralls.yml
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
composer.json
composer.lock
mkdocs.yml
phpcs.xml Initial commit Feb 27, 2018
phpunit.xml.dist Fixed `phpunit.xml.dist` after copy&paste from `zendframework/zend-co… Feb 27, 2018

README.md

zend-config-aggregator-modulemanager

Build Status Coverage Status

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

Usage

use Zend\ConfigAggregator\ConfigAggregator;
use Zend\ConfigAggregatorModuleManager\ZendModuleProvider;
use My\Zend\MvcModule\Module as MyZendMvcModule;

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

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

$aggregator = new ConfigAggregator([
    new ZendModuleProvider(new MyZendMvcModule()),
]);

var_dump($aggregator->getMergedConfig());

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

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

For more details, please refer to the documentation.