Example #1
0
 function Route()
 {
     return call_user_func_array(PHPKit\PHPKit::get(strtolower(__FUNCTION__)), func_get_args());
 }
Example #2
0
unset($loader);
// 类别名 PHPKit\PHPKit => PHPKit\App
PHPKit\PHPKit::classAlias(['PHPKit\\App' => PHPKit\PHPKit::class]);
/**
 * 注册/声明 用到的工具 设置初始化方法
 *
 * 祝玩的开心 ~ ^___^ ~
 */
return PHPKit\PHPKit::registerTools(['PHPKit', 'Helper', 'Heresy' => function () {
    $heresy = PHPKit\Heresy::getInstance();
    $heresy->searchNamespace(['PHPKit\\'])->bewitch('\\');
    return $heresy;
}, 'Config' => function () {
    $config = Config::getInstance();
    eachdir(__DIR__ . '/../config', function ($file) use($config) {
        $config->load($file);
    });
    return $config;
}, 'View' => function () {
    $view = View::getInstance();
    $view->setViewsDir(__DIR__ . '/../resources/views');
    return $view;
}, 'DB' => function () {
    $db = DB::getInstance();
    $db->setConfig(Config('database'));
    return $db;
}, 'AR', 'Session' => function () {
    $session = Session::getInstance();
    $session->start(Config('session'));
    return $session;
}])->alias('phpkit', 'app')->loadTools(['Heresy']);