-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoctris.php
executable file
·60 lines (49 loc) · 1.47 KB
/
octris.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
57
58
59
60
#!/usr/bin/env php
<?php
/*
* This file is part of the 'octris/octris' package.
*
* (c) Harald Lapp <harald@octris.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Main application.
*
* @copyright copyright (c) 2014-2015 by Harald Lapp
* @author Harald Lapp <harald@octris.org>
*/
/**/
if (version_compare(PHP_VERSION, '7.0.0') < 0) {
printf(
"%s: PHP-7.0.0 or newer is required, your version is '%s'!\n",
basename($argv[0]),
PHP_VERSION
);
exit(1);
}
if (php_sapi_name() == 'cli-server') {
// run using cli-server, probably because tool was executed with Httpd command.
return require_once(__DIR__ . '/libs/Util/Router.php');
}
if ($argc > 2 && $argv[1] == 'exec') {
// execute bundled tool
require_once(__DIR__ . '/libs/Util/Exec.php');
exit(0);
}
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/libs/Autoloader.php');
// import environment
\Octris\Core\Provider::set('env', $_ENV);
// load application configuration
define('OCTRIS_APP_VENDOR', 'octris');
define('OCTRIS_APP_NAME', 'octris');
define('OCTRIS_APP_BASE', realpath(__DIR__));
$registry = \Octris\Core\Registry::getInstance();
$registry->set('config', function () {
return new \Octris\Core\Config('config');
}, \Octris\Core\Registry::T_SHARED | \Octris\Core\Registry::T_READONLY);
// run application
$app = new \Octris\App();
$app->run();