9c388bef43491949dcb20255d8ca971669a12f17
[zf2.biz/application_blanche.git] / public / index.php
1 <?php
2 // Define application environment
3 defined('APPLICATION_ENV')
4     || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
5
6 // Ensure ZF is on the include path
7 set_include_path(implode(PATH_SEPARATOR, array(
8     realpath(__DIR__ . '/../library'),
9     realpath(__DIR__ . '/../library/ZendFramework/library'),
10     get_include_path(),
11 )));
12
13 require_once 'Zend/Loader/AutoloaderFactory.php';
14 Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
15
16 $appConfig = include __DIR__ . '/../configs/application.config.php';
17
18 $moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']);
19 $moduleLoader->register();
20
21 $moduleManager = new Zend\Module\Manager($appConfig['modules']);
22 $listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
23 $moduleManager->setDefaultListenerOptions($listenerOptions);
24 $moduleManager->loadModules();
25
26 // Create application, bootstrap, and run
27 $bootstrap      = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig());
28 $application    = new Zend\Mvc\Application;
29 $bootstrap->bootstrap($application);
30 $application->run()->send();