-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.php
37 lines (31 loc) · 942 Bytes
/
index.php
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
<?php
/**
* @author PhileCMS
* @link https://philecms.com
* @license http://opensource.org/licenses/MIT
* @package Phile
*/
ob_start();
require 'lib/vendor/autoload.php';
require 'config/bootstrap.php';
$app = Phile\Core\Container::getInstance()->get('Phile_App');
$server = new Phile\Http\Server($app);
$request = \Laminas\Diactoros\ServerRequestFactory::fromGlobals();
try {
$app->bootstrap();
$response = $server->run($request);
$earlyOutput = ob_get_contents();
if (!empty($earlyOutput)) {
return;
}
$server->emit($response);
} catch (\Throwable $e) {
if (\Phile\Core\ServiceLocator::hasService('Phile_ErrorHandler')) {
ob_end_clean();
/** @var \Phile\ServiceLocator\ErrorHandlerInterface $errorHandler */
$errorHandler = \Phile\Core\ServiceLocator::getService('Phile_ErrorHandler');
$errorHandler->handleException($e);
} else {
throw $e;
}
}