|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -/** |
4 |
| - * Laravel - A PHP Framework For Web Artisans |
5 |
| - * |
6 |
| - * @author Taylor Otwell <[email protected]> |
7 |
| - */ |
| 3 | +use Illuminate\Contracts\Http\Kernel; |
| 4 | +use Illuminate\Http\Request; |
| 5 | + |
| 6 | +define('LARAVEL_START', microtime(true)); |
8 | 7 |
|
9 | 8 | /*
|
10 | 9 | |--------------------------------------------------------------------------
|
11 |
| -| Register The Auto Loader |
| 10 | +| Check If Application Is Under Maintenance |
12 | 11 | |--------------------------------------------------------------------------
|
13 | 12 | |
|
14 |
| -| Composer provides a convenient, automatically generated class loader for |
15 |
| -| our application. We just need to utilize it! We'll simply require it |
16 |
| -| into the script here so that we don't have to worry about manual |
17 |
| -| loading any of our classes later on. It feels great to relax. |
| 13 | +| If the application is maintenance / demo mode via the "down" command we |
| 14 | +| will require this file so that any prerendered template can be shown |
| 15 | +| instead of starting the framework, which could cause an exception. |
18 | 16 | |
|
19 | 17 | */
|
20 | 18 |
|
21 |
| -require __DIR__ . '/../vendor/autoload.php'; |
| 19 | +if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) { |
| 20 | + require __DIR__ . '/../storage/framework/maintenance.php'; |
| 21 | +} |
22 | 22 |
|
23 | 23 | /*
|
24 | 24 | |--------------------------------------------------------------------------
|
25 |
| -| Turn On The Lights |
| 25 | +| Register The Auto Loader |
26 | 26 | |--------------------------------------------------------------------------
|
27 | 27 | |
|
28 |
| -| We need to illuminate PHP development, so let us turn on the lights. |
29 |
| -| This bootstraps the framework and gets it ready for use, then it |
30 |
| -| will load up this application so that we can run it and send |
31 |
| -| the responses back to the browser and delight our users. |
| 28 | +| Composer provides a convenient, automatically generated class loader for |
| 29 | +| this application. We just need to utilize it! We'll simply require it |
| 30 | +| into the script here so we don't need to manually load our classes. |
32 | 31 | |
|
33 | 32 | */
|
34 | 33 |
|
35 |
| -$app = require_once __DIR__ . '/../bootstrap/app.php'; |
| 34 | +require __DIR__ . '/../vendor/autoload.php'; |
36 | 35 |
|
37 | 36 | /*
|
38 | 37 | |--------------------------------------------------------------------------
|
39 | 38 | | Run The Application
|
40 | 39 | |--------------------------------------------------------------------------
|
41 | 40 | |
|
42 |
| -| Once we have the application, we can handle the incoming request |
43 |
| -| through the kernel, and send the associated response back to |
44 |
| -| the client's browser allowing them to enjoy the creative |
45 |
| -| and wonderful application we have prepared for them. |
| 41 | +| Once we have the application, we can handle the incoming request using |
| 42 | +| the application's HTTP kernel. Then, we will send the response back |
| 43 | +| to this client's browser, allowing them to enjoy our application. |
46 | 44 | |
|
47 | 45 | */
|
48 | 46 |
|
49 |
| -$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); |
50 |
| - |
51 |
| -$_SERVER['HTTP_ACCEPT'] = 'application/json'; // force json accepted |
| 47 | +$app = require_once __DIR__ . '/../bootstrap/app.php'; |
52 | 48 |
|
53 |
| -$response = $kernel->handle( |
54 |
| - $request = Illuminate\Http\Request::capture() |
55 |
| -); |
| 49 | +$kernel = $app->make(Kernel::class); |
56 | 50 |
|
57 |
| -$response->send(); |
| 51 | +$response = tap($kernel->handle( |
| 52 | + $request = Request::capture() |
| 53 | +))->send(); |
58 | 54 |
|
59 | 55 | $kernel->terminate($request, $response);
|
0 commit comments