X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=public%2Findex.php;h=5408a8c013cd32137991f9d7efd83428c4006b94;hb=6efa08bc12dfa3681612397d2885138de5adadfa;hp=cd83a90ede8a84758204edd2e8b162358f3db38b;hpb=a7f22ba984ddda1d8d01ee027fa76b73b1074407;p=zf2.biz%2Fapplication_blanche.git diff --git a/public/index.php b/public/index.php index cd83a90..5408a8c 100644 --- a/public/index.php +++ b/public/index.php @@ -1,30 +1,24 @@ 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'], - new Zend\Module\ManagerOptions($appConfig['module_manager_options']) -); +// Setup service manager +$serviceManager = new ServiceManager(new ServiceManagerConfiguration($configuration['service_manager'])); +$serviceManager->setService('ApplicationConfiguration', $configuration); +$serviceManager->get('ModuleManager')->loadModules(); -// Create application, bootstrap, and run -$bootstrapClass = $appConfig['bootstrap_class']; -$bootstrap = new $bootstrapClass($moduleManager); -$application = new Zend\Mvc\Application; -$bootstrap->bootstrap($application); -$application->run()->send(); +// Run application +$serviceManager->get('Application')->bootstrap()->run()->send();