bootstrap.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php namespace Laravel;
  2. // --------------------------------------------------------------
  3. // Define the PHP file extension.
  4. // --------------------------------------------------------------
  5. define('EXT', '.php');
  6. // --------------------------------------------------------------
  7. // Define the core framework paths.
  8. // --------------------------------------------------------------
  9. define('APP_PATH', realpath($application).'/');
  10. define('BASE_PATH', realpath(str_replace('laravel', '', $laravel)).'/');
  11. define('PACKAGE_PATH', realpath($packages).'/');
  12. define('PUBLIC_PATH', realpath($public).'/');
  13. define('STORAGE_PATH', realpath($storage).'/');
  14. define('SYS_PATH', realpath($laravel).'/');
  15. unset($laravel, $application, $config, $packages, $public, $storage);
  16. // --------------------------------------------------------------
  17. // Define various other framework paths.
  18. // --------------------------------------------------------------
  19. define('CACHE_PATH', STORAGE_PATH.'cache/');
  20. define('CONFIG_PATH', APP_PATH.'config/');
  21. define('CONTROLLER_PATH', APP_PATH.'controllers/');
  22. define('DATABASE_PATH', STORAGE_PATH.'database/');
  23. define('LANG_PATH', APP_PATH.'language/');
  24. define('SESSION_PATH', STORAGE_PATH.'sessions/');
  25. define('SYS_CONFIG_PATH', SYS_PATH.'config/');
  26. define('SYS_LANG_PATH', SYS_PATH.'language/');
  27. define('VIEW_PATH', APP_PATH.'views/');
  28. // --------------------------------------------------------------
  29. // Load the configuration manager and its dependencies.
  30. // --------------------------------------------------------------
  31. require SYS_PATH.'facades'.EXT;
  32. require SYS_PATH.'config'.EXT;
  33. require SYS_PATH.'arr'.EXT;
  34. // --------------------------------------------------------------
  35. // Bootstrap the IoC container.
  36. // --------------------------------------------------------------
  37. require SYS_PATH.'container'.EXT;
  38. $dependencies = require SYS_CONFIG_PATH.'container'.EXT;
  39. if (file_exists($path = CONFIG_PATH.'container'.EXT))
  40. {
  41. $dependencies = array_merge($dependencies, require $path);
  42. }
  43. if (isset($_SERVER['LARAVEL_ENV']) and file_exists($path = CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/container'.EXT))
  44. {
  45. $dependencies = array_merge($dependencies, require $path);
  46. }
  47. $container = new Container($dependencies);
  48. IoC::$container = $container;
  49. // --------------------------------------------------------------
  50. // Register the auto-loader on the auto-loader stack.
  51. // --------------------------------------------------------------
  52. spl_autoload_register(array($container->resolve('laravel.loader'), 'load'));