add library to the include path, so we can put ZF2's Zend folder directly in library
[zf2.biz/galerie.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(
22     $appConfig['modules'],
23     new Zend\Module\ManagerOptions($appConfig['module_manager_options'])
24 );
25
26 // Create application, bootstrap, and run
27 $bootstrap      = new Zend\Mvc\Bootstrap($moduleManager);
28 $application    = new Zend\Mvc\Application;
29 $bootstrap->bootstrap($application);
30 $application->run()->send();