core.php 2.7 KB

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