core.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php namespace Laravel;
  2. /**
  3. * Define all of the constants that we will need to use the framework.
  4. * These are things like file extensions, as well as all of the paths
  5. * used by the framework. All of the paths are built on top of the
  6. * basic application, laravel, and public paths.
  7. */
  8. define('EXT', '.php');
  9. define('CRLF', "\r\n");
  10. define('BLADE_EXT', '.blade.php');
  11. define('CACHE_PATH', STORAGE_PATH.'cache'.DS);
  12. define('DATABASE_PATH', STORAGE_PATH.'database'.DS);
  13. define('SESSION_PATH', STORAGE_PATH.'sessions'.DS);
  14. define('DEFAULT_BUNDLE', 'application');
  15. define('MB_STRING', (int) function_exists('mb_get_info'));
  16. /**
  17. * Require all of the classes that can't be loaded by the auto-loader.
  18. * These are typically classes that the auto-loader relies upon to
  19. * load classes, such as the array and configuration classes.
  20. */
  21. require SYS_PATH.'bundle'.EXT;
  22. require SYS_PATH.'config'.EXT;
  23. require SYS_PATH.'helpers'.EXT;
  24. require SYS_PATH.'autoloader'.EXT;
  25. /**
  26. * Register the Autoloader's "load" method on the auto-loader stack.
  27. * This method provides the lazy-loading of all class files, as well
  28. * as any PSR-0 compliant libraries used by the application.
  29. */
  30. spl_autoload_register(array('Laravel\\Autoloader', 'load'));
  31. /**
  32. * Register all of the core class aliases. These aliases provide a
  33. * convenient way of working with the Laravel core classes without
  34. * having to worry about the namespacing. The developer is also
  35. * free to remove aliases when they extend core classes.
  36. */
  37. Autoloader::$aliases = Config::get('application.aliases');
  38. /**
  39. * Register all of the bundles that are defined in the bundle info
  40. * file within the bundles directory. This informs the framework
  41. * where the bundle lives and which URIs it responds to.
  42. */
  43. $bundles = require BUNDLE_PATH.'bundles'.EXT;
  44. foreach ($bundles as $bundle => $value)
  45. {
  46. if (is_numeric($bundle)) $bundle = $value;
  47. Bundle::register($bundle, $value);
  48. }