-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun
60 lines (49 loc) · 1.34 KB
/
run
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
use App\Core\DI;
define('ROOT_PATH', __DIR__);
define('APP_PATH', ROOT_PATH . '/app');
define('IS_CLI', true);
/**
* The FactoryDefault Dependency Injector automatically registers the services that
* provide a full stack framework. These default services can be overidden with custom ones.
*/
// $di = new CliDi();
/**
* Read vendor autoload
*/
if (file_exists(ROOT_PATH . "/vendor/autoload.php")) {
include ROOT_PATH . "/vendor/autoload.php";
}
/**
* Get config service for use in inline setup below
*/
$config = include APP_PATH . "/config/config.php";
/**
* Include Autoloader
*/
include APP_PATH . '/config/loader.php';
/** 设置时区 */
ini_set('date.timezone', $config->timezone);
/**
* Create a console application
*/
$di = (new DI($config))->getDI();
/** @var \Xin\Phalcon\Cli\XConsole $console */
$console = $di->getShared('xconsole');
/**
* Handle
*/
$console->handle($argv);
/**
* If configs is set to true, then we print a new line at the end of each execution
*
* If we dont print a new line,
* then the next command prompt will be placed directly on the left of the output
* and it is less readable.
*
* You can disable this behaviour if the output of your application needs to don't have a new line at end
*/
if (isset($config["printNewLine"]) && $config["printNewLine"]) {
echo PHP_EOL;
}