PHP code example of laminas / laminas-config-aggregator-modulemanager
1. Go to this page and download the library: Download laminas/laminas-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/ */
laminas / laminas-config-aggregator-modulemanager example snippets
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());
array(1) {
'dependencies' =>
array(1) {
'invokables' =>
array(1) {
'My\Laminas\MvcModule\Service\MyService' =>
string(35) "My\Laminas\MvcModule\Service\MyService"
}
}
}