-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathBootstrap.php
More file actions
92 lines (76 loc) · 1.79 KB
/
Copy pathBootstrap.php
File metadata and controls
92 lines (76 loc) · 1.79 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
83
84
85
86
87
88
89
90
91
92
<?php
use Lily\HTTP\Request;
use Lily\HTTP\Response;
use Lily\Routing\Router;
use Lily\Registry\Registry;
use Lily\Template\Template;
use Lily\FrontController\FrontController;
use Lily\AppConfig;
use Lily\Session\SessionManager;
/**
* Check for the minimum requirements to run the application
*/
/**
* Instantiate the Application Configuration Object
*/
$appConfig = AppConfig::getInstance();
/**
* Check the minimum requirements for the application to run with no errors
*/
$appConfig->checkForMinimumRequirements();
/**
* Load the application paths
*/
$appConfig->loadAppPaths();
/**
* Load the mbstring extension default settings
*/
$appConfig->loadMBStringConfig();
/**
* Instantiate the HTTP Request Object
*/
$request = new Request;
/**
* Instantiate the HTTP Response Object
*/
$response = new Response;
/**
* Instantiate the Routing Table and the APP Router
*/
$routeCollection = $appConfig->loadRoutes();
$router = new Router;
$router->setRequest($request)
->setResponse($response)
->addRoutingTable($routeCollection)
->route();
/**
* Instantiate the Template blocks and the Template Engine
*/
$templateBlocks = $appConfig->loadTemplateConfig();
$template = new Template($templateBlocks);
/**
* Instantiate the session handler
*/
$appConfig->loadSessionConfig();
$session = new SessionManager;
$session->start();
/**
* Instantiate the Registry Object
*/
$registry = Registry::getInstance();
/**
* Add the HTTP Request Object to the app registry
*/
$registry->request = $request;
/**
* Add the HTTP Response Object to the app registry
*/
$registry->response = $response;
/**
* Add the Session Object to the app registry
*/
$registry->session = $session;
/**
* Instantiate the FrontController Object
*/
$frontController = new FrontController($router, $registry, $template);