This repository was archived by the owner on Apr 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
82 lines (59 loc) · 1.55 KB
/
index.php
File metadata and controls
82 lines (59 loc) · 1.55 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
* Cider
*
* Cider is a PHP based object oriented nano-framework for building small web applications.
*
* @author Carbin Creative <hej@carbin.se>
* @license http://opensource.org/licenses/MIT MIT
*/
/* @namespace Cider */
namespace Cider;
/* @imports */
use Cider\Exceptions\FrameworkException;
/**
* @const string NAMESPACE_SEPARATOR
*/
define('NAMESPACE_SEPARATOR', '\\');
/**
* @const string CIDER_ROOT_PATH
*/
define('CIDER_ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
/* Set error handling */
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_erros', 'On');
/* Output buffer */
$outputBuffer = null;
/* Run the application */
try {
/* Load version file */
require_once CIDER_ROOT_PATH . 'version.php';
/* Load Cider bootstrap */
require_once implode(DIRECTORY_SEPARATOR, [
rtrim(CIDER_ROOT_PATH, DIRECTORY_SEPARATOR),
'src', 'vendor', 'Cider', 'bootstrap.php'
]);
ob_start();
/* Resolve HTTP request */
app()->http->resolve();
/* Load optional app bootstrap */
relativeRequire('app/bootstrap');
/* Load routes */
relativeRequire('app/routes');
/* @emits "rendering" */
app()->signal('rendering');
/* Dispatch current request URI */
echo dispatcher()->dispatch(uri());
/* Capture buffer */
$outputBuffer = ob_get_clean();
} catch (\Exception $exception) {
/* Dispatch generic exceptions */
$outputBuffer = dispatcher()->dispatchError($exception);
} finally {
/* Send HTTP headers */
app()->http->sendHeaders();
/* Send output */
echo $outputBuffer;
/* @emits "rendered" */
app()->signal('rendered');
}