core.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php namespace Laravel;
  2. define('EXT', '.php');
  3. define('CRLF', chr(13).chr(10));
  4. define('BLADE_EXT', '.blade.php');
  5. define('APP_PATH', realpath($application).'/');
  6. define('BASE_PATH', realpath("$laravel/..").'/');
  7. define('PUBLIC_PATH', realpath($public).'/');
  8. define('SYS_PATH', realpath($laravel).'/');
  9. define('STORAGE_PATH', APP_PATH.'storage/');
  10. define('CACHE_PATH', STORAGE_PATH.'cache/');
  11. define('CONFIG_PATH', APP_PATH.'config/');
  12. define('CONTROLLER_PATH', APP_PATH.'controllers/');
  13. define('DATABASE_PATH', STORAGE_PATH.'database/');
  14. define('LANG_PATH', APP_PATH.'language/');
  15. define('LIBRARY_PATH', APP_PATH.'libraries/');
  16. define('MODEL_PATH', APP_PATH.'models/');
  17. define('ROUTE_PATH', APP_PATH.'routes/');
  18. define('SESSION_PATH', STORAGE_PATH.'sessions/');
  19. define('SYS_CONFIG_PATH', SYS_PATH.'config/');
  20. define('SYS_VIEW_PATH', SYS_PATH.'views/');
  21. define('VIEW_PATH', APP_PATH.'views/');
  22. /**
  23. * Define the Laravel environment configuration path. This path is used
  24. * by the configuration class to load configuration options specific for
  25. * the server environment, allowing the developer to conveniently change
  26. * configuration options based on the application environment.
  27. *
  28. */
  29. $environment = '';
  30. if (isset($_SERVER['LARAVEL_ENV']))
  31. {
  32. $environment = CONFIG_PATH.$_SERVER['LARAVEL_ENV'].'/';
  33. }
  34. define('ENV_CONFIG_PATH', $environment);
  35. unset($application, $public, $laravel, $environment);
  36. /**
  37. * Require all of the classes that can't be loaded by the auto-loader.
  38. * These are typically classes that the auto-loader itself relies upon
  39. * to load classes, such as the array and configuration classes.
  40. */
  41. require SYS_PATH.'arr'.EXT;
  42. require SYS_PATH.'config'.EXT;
  43. require SYS_PATH.'facades'.EXT;
  44. require SYS_PATH.'autoloader'.EXT;
  45. /**
  46. * Load a few of the core configuration files that are loaded for every
  47. * request to the application. It is quicker to load them manually each
  48. * request rather than parse the keys for every request.
  49. */
  50. Config::load('application');
  51. Config::load('session');
  52. /**
  53. * Register the Autoloader's "load" method on the auto-loader stack.
  54. * This method provides the lazy-loading of all class files, as well
  55. * as any PSR-0 compliant libraries used by the application.
  56. */
  57. spl_autoload_register(array('Laravel\\Autoloader', 'load'));
  58. /**
  59. * Define a few global convenience functions to make our lives as
  60. * Laravel PHP developers a little more easy and enjoyable.
  61. */
  62. require SYS_PATH.'helpers'.EXT;