-
Notifications
You must be signed in to change notification settings - Fork 1
/
app
executable file
·35 lines (26 loc) · 693 Bytes
/
app
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
#!/usr/bin/env php
<?php
define ('APP_DIR', __DIR__);
define ('APP_MODE_CLI', true);
require APP_DIR.'/vendor/autoload.php';
// Mock $_SERVER environment
$_SERVER['DOCUMENT_ROOT'] = APP_DIR.'/public';
$_SERVER['HTTP_HOST'] = gethostname();
$_SERVER['REQUEST_URI'] = '';
// Load Classes
Loader::addPath(APP_DIR.'/classes');
// Load options
Options::loadPHP(APP_DIR.'/config.php');
// Caching strategy
Cache::using([
'redis',
'files' => [
'cache_dir' => Options::get('cache.dir',APP_DIR.'/cache')
],
]);
// App bootstrap
include APP_DIR.'/boot.php';
Event::trigger('app.run');
// Commands
foreach (glob(APP_DIR.'/commands/*.php') as $routedef) include $routedef;
CLI::run();