Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use Phalcon\Loader;
- use Phalcon\Mvc\Application;
- error_reporting(E_ALL);
- ini_set("display_errors", 1);
- date_default_timezone_set('Europe/Berlin');
- /** define some global constants if not yet (i.e. through testing enironment) */
- defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'dev');
- defined('APP_PATH') || define('APP_PATH', realpath(__DIR__ . '/../app'));
- defined('VENDOR_PATH') || define('VENDOR_PATH', APP_PATH . '/vendor');
- defined('BOOTSTRAP_DIR_PATH') || define('BOOTSTRAP_DIR_PATH', APP_PATH . '/common/bootstrap');
- defined('CONFIGS_PATH') || define('CONFIGS_PATH', APP_PATH . '/common/configs');
- try {
- require realpath(VENDOR_PATH . '/autoload.php');
- /** Register global namespaces */
- $loader = new Loader();
- $loader->registerNamespaces(require BOOTSTRAP_DIR_PATH . '/namespaces.php')->register();
- /** Register default dependencies */
- $dependencyInjector = new Phalcon\DI\FactoryDefault();
- // Set bcrypt work factor to 10
- $dependencyInjector->get('security')->setWorkFactor(10);
- /** Register our dependencies */
- require BOOTSTRAP_DIR_PATH . '/dependencies.php';
- //Create an application
- $application = new Application($dependencyInjector);
- // Register the installed modules
- $application->registerModules(require BOOTSTRAP_DIR_PATH . '/modules.php');
- // Start session
- $dependencyInjector->getShared('session');
- //Handle the request
- echo $application->handle()->getContent();
- } catch (\Exception $e) {
- if (isset($e->xdebug_message)) {
- echo $e->xdebug_message;
- } else {
- echo $e->getMessage();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement