PHP code example of zendframework / zend-config-aggregator-modulemanager

1. Go to this page and download the library: Download zendframework/zend-config-aggregator-modulemanager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zendframework / zend-config-aggregator-modulemanager example snippets


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());

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