start.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | PHP Display Errors Configuration
  5. |--------------------------------------------------------------------------
  6. |
  7. | Since Laravel intercepts and displays all errors with a detailed stack
  8. | trace, we can turn off the display_errors ini directive. However, you
  9. | may want to enable this option if you ever run into a dreaded white
  10. | screen of death, as it can provide some clues.
  11. |
  12. */
  13. ini_set('display_errors', 'Off');
  14. /*
  15. |--------------------------------------------------------------------------
  16. | Laravel Configuration Loader
  17. |--------------------------------------------------------------------------
  18. |
  19. | The Laravel configuration loader is responsible for returning an array
  20. | of configuration options for a given bundle and file. By default, we
  21. | use the files provided with Laravel; however, you are free to use
  22. | your own storage mechanism for configuration arrays.
  23. |
  24. */
  25. Laravel\Event::listen(Laravel\Config::loader, function($bundle, $file)
  26. {
  27. return Laravel\Config::file($bundle, $file);
  28. });
  29. /*
  30. |--------------------------------------------------------------------------
  31. | Register Class Aliases
  32. |--------------------------------------------------------------------------
  33. |
  34. | Aliases allow you to use classes without always specifying their fully
  35. | namespaced path. This is convenient for working with any library that
  36. | makes a heavy use of namespace for class organization. Here we will
  37. | simply register the configured class aliases.
  38. |
  39. */
  40. $aliases = Laravel\Config::get('application.aliases');
  41. Laravel\Autoloader::$aliases = $aliases;
  42. /*
  43. |--------------------------------------------------------------------------
  44. | Laravel View Loader
  45. |--------------------------------------------------------------------------
  46. |
  47. | The Laravel view loader is responsible for returning the full file path
  48. | for the given bundle and view. Of course, a default implementation is
  49. | provided to load views according to typical Laravel conventions but
  50. | you may change this to customize how your views are organized.
  51. |
  52. */
  53. Event::listen(View::loader, function($bundle, $view)
  54. {
  55. return View::file($bundle, $view);
  56. });
  57. /*
  58. |--------------------------------------------------------------------------
  59. | Laravel Language Loader
  60. |--------------------------------------------------------------------------
  61. |
  62. | The Laravel language loader is responsible for returning the array of
  63. | language lines for a given bundle, language, and "file". A default
  64. | implementation has been provided which uses the default language
  65. | directories included with Laravel. However, you may tweak this
  66. | method to laad your language arrays however you wish.
  67. |
  68. */
  69. Event::listen(Lang::loader, function($bundle, $language, $file)
  70. {
  71. return Lang::file($bundle, $language, $file);
  72. });
  73. /*
  74. |--------------------------------------------------------------------------
  75. | Set The Default Timezone
  76. |--------------------------------------------------------------------------
  77. |
  78. | We need to set the default timezone for the application. This controls
  79. | the timezone that will be used by any of the date methods and classes
  80. | utilized by Laravel or your application. The timezone may be set in
  81. | your application configuration file.
  82. |
  83. */
  84. date_default_timezone_set(Config::get('application.timezone'));
  85. /*
  86. |--------------------------------------------------------------------------
  87. | Start / Load The User Session
  88. |--------------------------------------------------------------------------
  89. |
  90. | Sessions allow the web, which is stateless, to simulate state. In other
  91. | words, sessions allow you to store information about the current user
  92. | and state of your application. Here we'll just fire up the session
  93. | if a session driver has been configured.
  94. |
  95. */
  96. if (Config::get('session.driver') !== '')
  97. {
  98. Session::load();
  99. }
  100. /*
  101. |--------------------------------------------------------------------------
  102. | Auto-Loader Mappings
  103. |--------------------------------------------------------------------------
  104. |
  105. | Laravel uses a simple array of class to path mappings to drive the class
  106. | auto-loader. This simple approach helps avoid the performance problems
  107. | of searching through directories by convention.
  108. |
  109. | Registering a mapping couldn't be easier. Just pass an array of class
  110. | to path maps into the "map" function of Autoloader. Then, when you
  111. | want to use that class, just use it. It's simple!
  112. |
  113. */
  114. Autoloader::map(array(
  115. 'Base_Controller' => path('app').'controllers/base.php',
  116. ));
  117. /*
  118. |--------------------------------------------------------------------------
  119. | Auto-Loader Directories
  120. |--------------------------------------------------------------------------
  121. |
  122. | The Laravel auto-loader can search directories for files using the PSR-0
  123. | naming convention. This convention basically organizes classes by using
  124. | the class namespace to indicate the directory structure.
  125. |
  126. | So you don't have to manually map all of your models, we've added the
  127. | models and libraries directories for you. So, you can model away and
  128. | the auto-loader will take care of the rest.
  129. |
  130. */
  131. Autoloader::directories(array(
  132. path('app').'models',
  133. path('app').'libraries',
  134. ));