Add optional config filename prefix
[zf2.biz/application_blanche.git] / public / index.php
1 <?php
2 chdir(dirname(__DIR__));
3 require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php';
4 Zend\Loader\AutoloaderFactory::factory();
5
6 $appConfig = include 'config/application.config.php';
7
8 $listenerOptions  = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
9 $defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions);
10 $defaultListeners->getConfigListener()->addConfigGlobPath("config/autoload/{,*.}{global,local}.config.php");
11     
12
13 $moduleManager = new Zend\Module\Manager($appConfig['modules']);
14 $moduleManager->events()->attachAggregate($defaultListeners);
15 $moduleManager->loadModules();
16
17 // Create application, bootstrap, and run
18 $bootstrap   = new Zend\Mvc\Bootstrap($defaultListeners->getConfigListener()->getMergedConfig());
19 $application = new Zend\Mvc\Application;
20 $bootstrap->bootstrap($application);
21 $application->run()->send();