forked from piotrooo/php-shell-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
psf.php
executable file
·30 lines (24 loc) · 969 Bytes
/
psf.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
#!/usr/bin/env php
<?php
error_reporting(E_ALL);
$isComposer = true;
use Psf\Dispatcher;
use Psf\Loader;
define('ROOT_PATH', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
if ($isComposer) {
define('APPLICATION_PATH', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
/** @noinspection PhpIncludeInspection */
$psfConfig = require_once APPLICATION_PATH . 'psf.conf.php';
} else {
define('APPLICATION_PATH', __DIR__ . DIRECTORY_SEPARATOR);
/** @noinspection PhpIncludeInspection */
$psfConfig = require_once APPLICATION_PATH . 'config/psf.conf.php';
}
/** @noinspection PhpIncludeInspection */
require_once ROOT_PATH . 'lib' . DIRECTORY_SEPARATOR . 'Psf' . DIRECTORY_SEPARATOR . 'Loader.php';
$loader = new Loader();
$loader
->setIncludePath($psfConfig['application-dirs'])
->setIncludePath(ROOT_PATH . 'lib/')
->register();
Dispatcher::runScript($argv);