expressolivretools / bootstrap / app.php @ ab2f5151
Histórico | Ver | Anotar | Baixar (3,37 KB)
1 | 3e379cec | Alexandre Correia | <?php
|
---|---|---|---|
2 | |||
3 | require_once __DIR__.'/../vendor/autoload.php'; |
||
4 | |||
5 | (new Laravel\Lumen\Bootstrap\LoadEnvironmentVariables( |
||
6 | dirname(__DIR__) |
||
7 | ))->bootstrap(); |
||
8 | |||
9 | date_default_timezone_set(env('APP_TIMEZONE', 'UTC')); |
||
10 | |||
11 | /*
|
||
12 | |--------------------------------------------------------------------------
|
||
13 | | Create The Application
|
||
14 | |--------------------------------------------------------------------------
|
||
15 | |
|
||
16 | | Here we will load the environment and create the application instance
|
||
17 | | that serves as the central piece of this framework. We'll use this
|
||
18 | | application as an "IoC" container and router for this framework.
|
||
19 | |
|
||
20 | */
|
||
21 | |||
22 | $app = new Laravel\Lumen\Application( |
||
23 | dirname(__DIR__) |
||
24 | ); |
||
25 | |||
26 | $app->withFacades();
|
||
27 | |||
28 | $app->withEloquent();
|
||
29 | |||
30 | /*
|
||
31 | |--------------------------------------------------------------------------
|
||
32 | | Register Container Bindings
|
||
33 | |--------------------------------------------------------------------------
|
||
34 | |
|
||
35 | | Now we will register a few bindings in the service container. We will
|
||
36 | | register the exception handler and the console kernel. You may add
|
||
37 | | your own bindings here if you like or you can make another file.
|
||
38 | |
|
||
39 | */
|
||
40 | |||
41 | $app->singleton(
|
||
42 | Illuminate\Contracts\Debug\ExceptionHandler::class, |
||
43 | App\Exceptions\Handler::class |
||
44 | ); |
||
45 | |||
46 | $app->singleton(
|
||
47 | Illuminate\Contracts\Console\Kernel::class, |
||
48 | App\Console\Kernel::class |
||
49 | ); |
||
50 | |||
51 | /*
|
||
52 | |--------------------------------------------------------------------------
|
||
53 | | Register Config Files
|
||
54 | |--------------------------------------------------------------------------
|
||
55 | |
|
||
56 | | Now we will register the "app" configuration file. If the file exists in
|
||
57 | | your configuration directory it will be loaded; otherwise, we'll load
|
||
58 | | the default version. You may register other files below as needed.
|
||
59 | |
|
||
60 | */
|
||
61 | |||
62 | $app->configure('app'); |
||
63 | |||
64 | /*
|
||
65 | |--------------------------------------------------------------------------
|
||
66 | | Register Middleware
|
||
67 | |--------------------------------------------------------------------------
|
||
68 | |
|
||
69 | | Next, we will register the middleware with the application. These can
|
||
70 | | be global middleware that run before and after each request into a
|
||
71 | | route or middleware that'll be assigned to some specific routes.
|
||
72 | |
|
||
73 | */
|
||
74 | |||
75 | // $app->middleware([
|
||
76 | // App\Http\Middleware\ExampleMiddleware::class
|
||
77 | // ]);
|
||
78 | |||
79 | // $app->routeMiddleware([
|
||
80 | // 'auth' => App\Http\Middleware\Authenticate::class,
|
||
81 | // ]);
|
||
82 | |||
83 | /*
|
||
84 | |--------------------------------------------------------------------------
|
||
85 | | Register Service Providers
|
||
86 | |--------------------------------------------------------------------------
|
||
87 | |
|
||
88 | | Here we will register all of the application's service providers which
|
||
89 | | are used to bind services into the container. Service providers are
|
||
90 | | totally optional, so you are not required to uncomment this line.
|
||
91 | |
|
||
92 | */
|
||
93 | |||
94 | // $app->register(App\Providers\AppServiceProvider::class);
|
||
95 | // $app->register(App\Providers\AuthServiceProvider::class);
|
||
96 | // $app->register(App\Providers\EventServiceProvider::class);
|
||
97 | |||
98 | /*
|
||
99 | |--------------------------------------------------------------------------
|
||
100 | | Load The Application Routes
|
||
101 | |--------------------------------------------------------------------------
|
||
102 | |
|
||
103 | | Next we will include the routes file so that they can all be added to
|
||
104 | | the application. This will provide all of the URLs the application
|
||
105 | | can respond to, as well as the controllers that may handle them.
|
||
106 | |
|
||
107 | */
|
||
108 | |||
109 | $app->router->group([
|
||
110 | 'namespace' => 'App\Http\Controllers', |
||
111 | ], function ($router) { |
||
112 | require __DIR__.'/../routes/web.php'; |
||
113 | }); |
||
114 | |||
115 | return $app; |