Created
June 17, 2013 21:38
-
-
Save johnvilsack/5800702 to your computer and use it in GitHub Desktop.
Phalcon Default Bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$config = include __DIR__ . '/../app/config/config.php'; | |
$loader = new Phalcon\Loader(); | |
$loader->registerDirs(array( | |
$config->application->controllersDir, | |
$config->application->modelsDir | |
))->register(); | |
$di = new Phalcon\DI\FactoryDefault(); | |
$di->set('view', function() use ($config) { | |
$view = new Phalcon\Mvc\View(); | |
$view->setViewsDir($config->application->viewsDir); | |
return $view; | |
}); | |
$application = new Phalcon\Mvc\Application(); | |
$application->setDI($di); | |
if(!empty($_SERVER['PATH_INFO'])) { | |
$pathInfo = $_SERVER['PATH_INFO']; | |
} else { | |
$pathInfo = '/'; | |
} | |
echo $application->handle($pathInfo)->getContent(); | |
} catch(\Phalcon\Exception $e) { | |
echo "Phalcon Exception: ", $e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment