-
Notifications
You must be signed in to change notification settings - Fork 0
/
king
66 lines (52 loc) · 1.75 KB
/
king
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
#!/usr/bin/env php
<?php
if (substr(php_sapi_name(), 0, 3) === 'cgi') {
die("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
}
error_reporting(E_ALL);
define('DS', DIRECTORY_SEPARATOR);
define('FCPATH', __DIR__ . '/public' . DIRECTORY_SEPARATOR);
define('EXT', '.php');
define('ENV', 'prod');
define('SCRIPT', true);
defined('ENV_PREFIX') or define('ENV_PREFIX', 'PHP_');
$public_directory = 'public';
$app_directory = 'application';
$system_directory = '../system';
$test_directory = 'tests';
$pos = strrpos(FCPATH, $public_directory . DS);
if (!defined('ROOT_PATH')) {
define('ROOT_PATH', substr_replace(FCPATH, '', $pos, strlen($public_directory . DS)));
}
if (!defined('APP_PATH')) {
define('APP_PATH', realpath(ROOT_PATH . $app_directory) . DS);
}
if (!defined('TEST_PATH')) {
define('TEST_PATH', realpath(ROOT_PATH . $test_directory) . DS);
}
if (!defined('SYS_PATH')) {
define('SYS_PATH', realpath(ROOT_PATH . $system_directory) . DS);
}
if (!defined('VENDOR_PATH')) {
define('VENDOR_PATH', realpath(APP_PATH . 'vendor') . DS);
}
$env_file = '.env';
if (isset($_SERVER['ENV_FILE']) && $_SERVER['ENV_FILE']) {
$env_file = $_SERVER['ENV_FILE'];
}
require SYS_PATH . 'lib/Env.php';
\king\lib\Env::loadFile(APP_PATH . $env_file);
require SYS_PATH . 'core/Loader.php';
if (C('use_composer') && is_file(APP_PATH . 'vendor/autoload.php')) {
require APP_PATH . 'vendor/autoload.php';
}
spl_autoload_register('king\core\Loader::autoload', true, true);
if (!empty(C('timezone'))) {
date_default_timezone_set(C('timezone'));
}
\king\core\Error::register();
if (C('sentry') != false) {
\Sentry\init(['dsn' => C('sentry.dsn')]);
\Sentry\ErrorHandler::registerOnce();
}
(new \king\lib\Console)->run();