core.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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('DEFAULT_BUNDLE', 'application');
  12. define('MB_STRING', (int) function_exists('mb_get_info'));
  13. /**
  14. * Require all of the classes that can't be loaded by the auto-loader.
  15. * These are typically classes that the auto-loader relies upon to
  16. * load classes, such as the array and configuration classes.
  17. */
  18. require path('sys').'event'.EXT;
  19. require path('sys').'bundle'.EXT;
  20. require path('sys').'config'.EXT;
  21. require path('sys').'helpers'.EXT;
  22. require path('sys').'autoloader'.EXT;
  23. /**
  24. * Register the Autoloader's "load" method on the auto-loader stack.
  25. * This method provides the lazy-loading of all class files, as well
  26. * as any PSR-0 compliant libraries used by the application.
  27. */
  28. spl_autoload_register(array('Laravel\\Autoloader', 'load'));
  29. /**
  30. * Register all of the core class aliases. These aliases provide a
  31. * convenient way of working with the Laravel core classes without
  32. * having to worry about the namespacing. The developer is also
  33. * free to remove aliases when they extend core classes.
  34. */
  35. Autoloader::$aliases = Config::get('application.aliases');
  36. /**
  37. * Register the Laravel namespace so that the auto-loader loads it
  38. * according to the PSR-0 naming conventions. This should provide
  39. * fast resolution of all core classes.
  40. */
  41. Autoloader::namespaces(array('Laravel' => path('sys')));
  42. /**
  43. * Grab the bundle manifest for the application. This contains an
  44. * array of all of the installed bundles, plus information about
  45. * each of them. If it's not cached, we'll detect them and then
  46. * cache it to save time later.
  47. */
  48. $bundles = Cache::remember('laravel.bundle.manifest', function()
  49. {
  50. return Bundle::detect(path('bundle'));
  51. }, Config::get('application.bundle.cache'));
  52. /**
  53. * Register all of the bundles that are defined in the main bundle
  54. * manifest. This informs the framework where the bundle lives
  55. * and which URIs it can respnod to.
  56. */
  57. foreach ($bundles as $bundle)
  58. {
  59. Bundle::register($bundle);
  60. }
  61. /**
  62. * Register the default timezone for the application. This will
  63. * be the default timezone used by all date functions through
  64. * throughout the entire application.
  65. */
  66. $timezone = Config::get('application.timezone');
  67. date_default_timezone_set($timezone);