Initial skeleton in place with ZF2 submodule pointed at current master
[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/ZendFramework/library'),
9     get_include_path(),
10 )));
11
12 require_once 'Zend/Loader/AutoloaderFactory.php';
13 Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
14
15 $appConfig = include __DIR__ . '/../configs/application.config.php';
16
17 $moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig->module_paths);
18 $moduleLoader->register();
19
20 $moduleManager = new Zend\Module\Manager(
21     $appConfig->modules,
22     new Zend\Module\ManagerOptions($appConfig->module_config)
23 );
24
25 // Get the merged config object
26 $config = $moduleManager->getMergedConfig();
27
28 // Create application, bootstrap, and run
29 $bootstrap = new $config->bootstrap_class($config, $moduleManager);
30 $application = new Zend\Mvc\Application;
31 $bootstrap->bootstrap($application);
32 $application->run()->send();