8007083f0f643b66fa25a967dd5c0cc02784bb81
[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 if (!($env = getenv('APPLICATION_ENV'))) {
7     $env = 'local';
8 }
9
10 $appConfig = include 'config/application.config.php';
11
12 $listenerOptions  = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
13 $defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions);
14 $defaultListeners->getConfigListener()->addConfigGlobPath("config/autoload/{module.*,global,$env,local}.config.php");
15     
16
17 $moduleManager = new Zend\Module\Manager($appConfig['modules']);
18 $moduleManager->events()->attachAggregate($defaultListeners);
19 $moduleManager->loadModules();
20
21 // Create application, bootstrap, and run
22 $bootstrap   = new Zend\Mvc\Bootstrap($defaultListeners->getConfigListener()->getMergedConfig());
23 $application = new Zend\Mvc\Application;
24 $bootstrap->bootstrap($application);
25 $application->run()->send();