You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.4 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. <?php
  2. $legacyErrorReporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED;
  3. error_reporting($legacyErrorReporting);
  4. require_once __DIR__.'/../vendor/autoload.php';
  5. if (file_exists(__DIR__.'/../.env')) {
  6. Dotenv::load(__DIR__.'/../');
  7. }
  8. /*
  9. |--------------------------------------------------------------------------
  10. | Create The Application
  11. |--------------------------------------------------------------------------
  12. |
  13. | Here we will load the environment and create the application instance
  14. | that serves as the central piece of this framework. We'll use this
  15. | application as an "IoC" container and router for this framework.
  16. |
  17. */
  18. $app = new Laravel\Lumen\Application(
  19. realpath(__DIR__.'/../')
  20. );
  21. error_reporting($legacyErrorReporting);
  22. Illuminate\Support\Facades\Facade::setFacadeApplication($app);
  23. // Lumen 5.1 aliases Event globally, which can collide with PHP's event extension.
  24. foreach ([
  25. 'App' => Illuminate\Support\Facades\App::class,
  26. 'Auth' => Illuminate\Support\Facades\Auth::class,
  27. 'Bus' => Illuminate\Support\Facades\Bus::class,
  28. 'DB' => Illuminate\Support\Facades\DB::class,
  29. 'Cache' => Illuminate\Support\Facades\Cache::class,
  30. 'Cookie' => Illuminate\Support\Facades\Cookie::class,
  31. 'Crypt' => Illuminate\Support\Facades\Crypt::class,
  32. 'Hash' => Illuminate\Support\Facades\Hash::class,
  33. 'Log' => Illuminate\Support\Facades\Log::class,
  34. 'Mail' => Illuminate\Support\Facades\Mail::class,
  35. 'Queue' => Illuminate\Support\Facades\Queue::class,
  36. 'Request' => Illuminate\Support\Facades\Request::class,
  37. 'Schema' => Illuminate\Support\Facades\Schema::class,
  38. 'Session' => Illuminate\Support\Facades\Session::class,
  39. 'Storage' => Illuminate\Support\Facades\Storage::class,
  40. 'Validator' => Illuminate\Support\Facades\Validator::class,
  41. ] as $alias => $class) {
  42. if (!class_exists($alias, false)) {
  43. class_alias($class, $alias);
  44. }
  45. }
  46. $aliasesRegistered = new ReflectionProperty(Laravel\Lumen\Application::class, 'aliasesRegistered');
  47. $aliasesRegistered->setAccessible(true);
  48. $aliasesRegistered->setValue(true);
  49. // $app->withEloquent();
  50. /*
  51. |--------------------------------------------------------------------------
  52. | Register Container Bindings
  53. |--------------------------------------------------------------------------
  54. |
  55. | Now we will register a few bindings in the service container. We will
  56. | register the exception handler and the console kernel. You may add
  57. | your own bindings here if you like or you can make another file.
  58. |
  59. */
  60. $app->singleton(
  61. Illuminate\Contracts\Debug\ExceptionHandler::class,
  62. App\Exceptions\Handler::class
  63. );
  64. $app->singleton(
  65. Illuminate\Contracts\Console\Kernel::class,
  66. App\Console\Kernel::class
  67. );
  68. /*
  69. |--------------------------------------------------------------------------
  70. | Register Middleware
  71. |--------------------------------------------------------------------------
  72. |
  73. | Next, we will register the middleware with the application. These can
  74. | be global middleware that run before and after each request into a
  75. | route or middleware that'll be assigned to some specific routes.
  76. |
  77. */
  78. $app->middleware([
  79. Illuminate\Cookie\Middleware\EncryptCookies::class,
  80. Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
  81. Illuminate\Session\Middleware\StartSession::class,
  82. // Illuminate\View\Middleware\ShareErrorsFromSession::class,
  83. // Laravel\Lumen\Http\Middleware\VerifyCsrfToken::class,
  84. ]);
  85. // $app->routeMiddleware([
  86. // ]);
  87. /*
  88. |--------------------------------------------------------------------------
  89. | Register Service Providers
  90. |--------------------------------------------------------------------------
  91. |
  92. | Here we will register all of the application's service providers which
  93. | are used to bind services into the container. Service providers are
  94. | totally optional, so you are not required to uncomment this line.
  95. |
  96. */
  97. // $app->register(App\Providers\AppServiceProvider::class);
  98. // $app->register(App\Providers\EventServiceProvider::class);
  99. /*
  100. |--------------------------------------------------------------------------
  101. | Load The Application Routes
  102. |--------------------------------------------------------------------------
  103. |
  104. | Next we will include the routes file so that they can all be added to
  105. | the application. This will provide all of the URLs the application
  106. | can respond to, as well as the controllers that may handle them.
  107. |
  108. */
  109. $app->group(['namespace' => 'App\Http\Controllers'], function ($app) {
  110. require __DIR__.'/../app/Http/routes.php';
  111. });
  112. return $app;