projects
/
zf2.biz
/
galerie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated composer.
[zf2.biz/galerie.git]
/
public
/
index.php
diff --git
a/public/index.php
b/public/index.php
index
9c388be
..
34c609d
100644
(file)
--- a/
public/index.php
+++ b/
public/index.php
@@
-1,30
+1,24
@@
<?php
<?php
-// Define application environment
-defined('APPLICATION_ENV')
- || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
+use Zend\ServiceManager\ServiceManager,
+ Zend\Mvc\Service\ServiceManagerConfiguration;
-// Ensure ZF is on the include path
-set_include_path(implode(PATH_SEPARATOR, array(
- realpath(__DIR__ . '/../library'),
- realpath(__DIR__ . '/../library/ZendFramework/library'),
- get_include_path(),
-)));
+chdir(dirname(__DIR__));
-require_once 'Zend/Loader/AutoloaderFactory.php';
-Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
+if (!file_exists('vendor/autoload.php')) {
+ throw new RuntimeException('vendor/autoload.php could not be found. Did you run php composer.phar install?');
+ exit;
+}
-$appConfig = include __DIR__ . '/../configs/application.config.php';
+// Composer autoloading
+require_once('vendor/autoload.php');
-$moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']);
-$moduleLoader->register();
+// Get application stack configuration.
+$configuration = include 'config/application.config.php';
-$moduleManager = new Zend\Module\Manager($appConfig['modules']);
-$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
-$moduleManager->setDefaultListenerOptions($listenerOptions);
-$moduleManager->loadModules();
+// Setup service manager.
+$serviceManager = new ServiceManager(new ServiceManagerConfiguration($configuration['service_manager']));
+$serviceManager->setService('ApplicationConfiguration', $configuration);
+$serviceManager->get('ModuleManager')->loadModules();
-// Create application, bootstrap, and run
-$bootstrap = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig());
-$application = new Zend\Mvc\Application;
-$bootstrap->bootstrap($application);
-$application->run()->send();
+// Run application.
+$serviceManager->get('Application')->bootstrap()->run()->send();