×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Сергей Шевченко
Added: Aug 9, 2017 8:03 AM
Modified: Aug 9, 2017 8:03 AM
Views: 12
Tags: no tags
  1. // Define application environment
  2. define('APPLICATION_ENV_DEV', 'development');
  3. define('APPLICATION_ENV_PROD', 'production');
  4. define('APPLICATION_ENV', APPLICATION_ENV_DEV);
  5.  
  6. // Define path to application directory
  7. define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
  8.  
  9. // Registration the autoloader
  10. $autoloader = require __DIR__ . '/../vendor/autoload.php';
  11.  
  12. // Configuration the application
  13. $config = ArrayMerger::doMerge(
  14.     require APPLICATION_PATH . '/configs/application.php',
  15.     require APPLICATION_PATH . '/configs/application-local.php'
  16. );
  17. if (php_sapi_name() == 'cli') {
  18.     $config = ArrayMerger::doMerge(
  19.         $config,
  20.         ArrayMerger::doMerge(
  21.             require APPLICATION_PATH . '/configs/application-cli.php',
  22.             require APPLICATION_PATH . '/configs/application-cli-local.php'
  23.         )
  24.     );
  25. } else {
  26.     $path = explode('/', $_SERVER['REQUEST_URI']);
  27.     if ($path[1] == 'api') {
  28.         $config = ArrayMerger::doMerge($config, require APPLICATION_PATH . '/configs/application-api.php');
  29.     }
  30. }
  31. $application = new Zend_Application(APPLICATION_ENV, $config);
  32.  
  33. // Run the application
  34. $application->bootstrap()->run();