This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
/
index.php.stub
54 lines (43 loc) · 1.66 KB
/
index.php.stub
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
use App\Http\Kernel;
use Narrowspark\HttpEmitter\EmitterInterface;
use Narrowspark\HttpEmitter\Util as EmitterUtil;
use Viserio\Component\Http\Util;
use Viserio\Component\HttpFactory\ServerRequestFactory;
\define('NARROWSPARK_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require_once \dirname(__DIR__) . '/vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| So let's turn on the lights.
| This bootstraps the framework and gets it ready for use.
|
*/
$kernel = new Kernel();
$serverRequest = (new ServerRequestFactory())->createServerRequestFromArray($_SERVER);
$serverRequest->withCookieParams($_COOKIE)
->withQueryParams($_GET)
->withParsedBody($_POST)
->withUploadedFiles(Util::normalizeFiles($_FILES));
$response = $kernel->handle($serverRequest);
$kernel->getContainer()->get(EmitterInterface::class)->emit($response);
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} elseif (!\in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
EmitterUtil::closeOutputBuffers(0, true);
}
$kernel->terminate($serverRequest, $response);