app.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. require_once __DIR__.'/../vendor/autoload.php';
  3. (new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables(
  4. dirname(__DIR__)
  5. ))->bootstrap();
  6. /*
  7. |--------------------------------------------------------------------------
  8. | Create The Application
  9. |--------------------------------------------------------------------------
  10. |
  11. | Here we will load the environment and create the application instance
  12. | that serves as the central piece of this framework. We'll use this
  13. | application as an "IoC" container and router for this framework.
  14. |
  15. */
  16. $app = new Laravel\Lumen\Application(
  17. dirname(__DIR__)
  18. );
  19. $app->withFacades();
  20. $app->withEloquent();
  21. /*
  22. |--------------------------------------------------------------------------
  23. | Register Container Bindings
  24. |--------------------------------------------------------------------------
  25. |
  26. | Now we will register a few bindings in the service container. We will
  27. | register the exception handler and the console kernel. You may add
  28. | your own bindings here if you like or you can make another file.
  29. |
  30. */
  31. $app->singleton(
  32. Illuminate\Contracts\Debug\ExceptionHandler::class,
  33. App\Exceptions\Handler::class
  34. );
  35. $app->singleton(
  36. Illuminate\Contracts\Console\Kernel::class,
  37. App\Console\Kernel::class
  38. );
  39. /*
  40. |--------------------------------------------------------------------------
  41. | Register Middleware
  42. |--------------------------------------------------------------------------
  43. |
  44. | Next, we will register the middleware with the application. These can
  45. | be global middleware that run before and after each request into a
  46. | route or middleware that'll be assigned to some specific routes.
  47. |
  48. */
  49. $app->middleware([
  50. App\Http\Middleware\ExampleMiddleware::class,
  51. // App\Http\Middleware\CorsMiddleware::class
  52. App\Http\Middleware\EnableCrossRequestMiddleware::class
  53. ]);
  54. $app->routeMiddleware([
  55. 'auth' => App\Http\Middleware\Authenticate::class,
  56. 'assit' => App\Http\Middleware\AssitMiddleware::class,
  57. 'request_log' => App\Http\Middleware\RequestLogMiddleware::class,
  58. ]);
  59. /*
  60. |--------------------------------------------------------------------------
  61. | Register Service Providers
  62. |--------------------------------------------------------------------------
  63. |
  64. | Here we will register all of the application's service providers which
  65. | are used to bind services into the container. Service providers are
  66. | totally optional, so you are not required to uncomment this line.
  67. |
  68. */
  69. $app->register(App\Providers\AppServiceProvider::class);
  70. $app->register(Dingo\Api\Provider\LumenServiceProvider::class);
  71. $app->register(Tymon\JWTAuth\Providers\LumenServiceProvider::class);
  72. $app->register( App\Providers\EasySmsServiceProvider::class);
  73. $app->register(Overtrue\LaravelWeChat\ServiceProvider::class);
  74. $app->register(App\Providers\AuthServiceProvider::class);
  75. $app->register(App\Providers\EventServiceProvider::class);
  76. $app->register(Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
  77. $app->register(Intervention\Image\ImageServiceProvider::class);
  78. $app->register(Jenssegers\Agent\AgentServiceProvider::class);
  79. $app->register(Illuminate\Queue\QueueServiceProvider::class);
  80. //$app->register(Ixudra\Curl\CurlServiceProvider::class);
  81. /*
  82. |--------------------------------------------------------------------------
  83. | Load The Application Routes
  84. |--------------------------------------------------------------------------
  85. |
  86. | Next we will include the routes file so that they can all be added to
  87. | the application. This will provide all of the URLs the application
  88. | can respond to, as well as the controllers that may handle them.
  89. |
  90. */
  91. $app->configure('easysms');
  92. $app->configure('auth');
  93. $app->configure('wechat');
  94. $app->configure('config');
  95. $app->configure('cachhe');
  96. $app->configure('faceplus');
  97. $app->configure('HFConfig');
  98. $app->configure('filesystems');
  99. $app->configure('queue');
  100. $app->router->group([
  101. 'namespace' => 'App\Http\Controllers',
  102. ], function ($router) {
  103. require __DIR__.'/../routes/web.php';
  104. });
  105. return $app;