Advertisement
Guest User

Untitled

a guest
Jan 28th, 2014
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.64 KB | None | 0 0
  1. <?php
  2. use Phalcon\Loader;
  3. use Phalcon\Mvc\Application;
  4.  
  5. error_reporting(E_ALL);
  6. ini_set("display_errors", 1);
  7. date_default_timezone_set('Europe/Berlin');
  8.  
  9. /** define some global constants if not yet (i.e. through testing enironment) */
  10. defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'dev');
  11. defined('APP_PATH') || define('APP_PATH', realpath(__DIR__ . '/../app'));
  12. defined('VENDOR_PATH') || define('VENDOR_PATH', APP_PATH . '/vendor');
  13. defined('BOOTSTRAP_DIR_PATH') || define('BOOTSTRAP_DIR_PATH', APP_PATH . '/common/bootstrap');
  14. defined('CONFIGS_PATH') || define('CONFIGS_PATH', APP_PATH . '/common/configs');
  15.  
  16. try {
  17.     require realpath(VENDOR_PATH . '/autoload.php');
  18.  
  19.     /** Register global namespaces */
  20.     $loader = new Loader();
  21.     $loader->registerNamespaces(require BOOTSTRAP_DIR_PATH . '/namespaces.php')->register();
  22.  
  23.     /** Register default dependencies */
  24.     $dependencyInjector = new Phalcon\DI\FactoryDefault();
  25.  
  26.     // Set bcrypt work factor to 10
  27.     $dependencyInjector->get('security')->setWorkFactor(10);
  28.  
  29.     /** Register our dependencies */
  30.     require BOOTSTRAP_DIR_PATH . '/dependencies.php';
  31.  
  32.     //Create an application
  33.     $application = new Application($dependencyInjector);
  34.     // Register the installed modules
  35.     $application->registerModules(require BOOTSTRAP_DIR_PATH . '/modules.php');
  36.  
  37.     // Start session
  38.     $dependencyInjector->getShared('session');
  39.  
  40.     //Handle the request
  41.     echo $application->handle()->getContent();
  42.  
  43. } catch (\Exception $e) {
  44.     if (isset($e->xdebug_message)) {
  45.         echo $e->xdebug_message;
  46.     } else {
  47.         echo $e->getMessage();
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement