forked from trackier/procurement-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoload.php
56 lines (44 loc) · 1.55 KB
/
autoload.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
ob_start();
define("DEBUG", True);
define("APP_PATH", dirname(__FILE__));
define("CDN", "/assets/");
define("CDN", "/node_modules/");
define("GCDN", "https://static.vnative.co/");
// 1. load the Core class that includes an autoloader
require_once(APP_PATH. "/framework/core.php");
Framework\Core::initialize();
// 2. Additional Path's which
Framework\Core::autoLoadPaths([
"/application/libraries",
"/application/Command",
"/application"
]);
// 3. load and initialize the Configuration class
$configuration = new Framework\Configuration(array(
"type" => "ini"
));
Framework\Registry::set("configuration", $configuration->initialize());
// Load the logger
$logger = new Framework\Logger();
Framework\Registry::setLogger($logger->initialize());
unset($logger);
// 4. load and initialize the Database class – does not connect
$database = new Framework\Database();
Framework\Registry::set("database", $database->initialize());
// 5. load and initialize the Cache class – does not connect
$cache = new Framework\Cache();
Framework\Registry::set("cache", $cache->initialize());
$redisCache = new Framework\Cache(['type' => 'redis']);
Framework\Registry::set("redis", $redisCache->initialize());
// 6. load and initialize the Session class
$session = new Framework\Session();
Framework\Registry::set("session", $session->initialize());
Shared\Services\Db::connect();
Framework\Registry::get("cache")->connect();
Framework\Registry::get("redis")->connect();
// 9. unset global variables
unset($configuration);
unset($database);
unset($cache);
unset($session);