-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.php
41 lines (35 loc) · 1.17 KB
/
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
38
39
40
41
<?php
use Dotenv\Dotenv;
use pukoframework\config\Factory;
use pukoframework\Framework;
require 'vendor/autoload.php';
//spin up environment variables with Dotenv.
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->safeLoad();
$protocol = 'http';
if (isset($_SERVER['HTTPS'])) {
$protocol = 'https';
} elseif (isset($_SERVER['HTTP_X_SCHEME'])) {
$protocol = strtolower($_SERVER['HTTP_X_SCHEME']);
} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
$protocol = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']);
} elseif (isset($_SERVER['SERVER_PORT'])) {
$serverPort = (int)$_SERVER['SERVER_PORT'];
if ($serverPort == 80) {
$protocol = 'http';
} elseif ($serverPort == 443) {
$protocol = 'https';
}
}
//possible value for environment: PROD, DEV, MAINTENANCE, DEMO.
//if website not installed in top level webserver you can set folder name at base with end trailing slash.
$factory = [
'cli_param' => null,
'environment' => 'DEV',
'base' => ($protocol . '://' . $_SERVER['HTTP_HOST'] . '/'),
'root' => __DIR__,
'start' => microtime(true),
];
$fo = new Factory($factory);
$framework = new Framework($fo);
$framework->Start();