示例#1
0
 /**
  * Get the specified app instance
  *
  * @param  string $name
  * @return \Upfor\App
  */
 function app($name = null)
 {
     static $currentApp = 'default';
     if ($name) {
         $currentApp = $name;
     }
     return App::getInstance($currentApp);
 }
示例#2
0
文件: index.php 项目: upfor/upforphp
<?php

define("DS", DIRECTORY_SEPARATOR);
define("ROOT", dirname(realpath(__DIR__)));
// Use composer
require ROOT . '/vendor/autoload.php';
// Or custom autoloader
//require ROOT . '/src/Helper/helpers.php';
//require ROOT . '/src/Autoloader.php';
//$autoloader = new \Upfor\Autoloader();
//$autoloader->addNamespace('Upfor\\', ROOT . '/src/');
//$autoloader->register();
$app = new \Upfor\App();
require ROOT . '/config/route.php';
$app->hook('upfor.after', function () use($app) {
    echo '<hr>upfor.after hook<hr>';
});
$app->hook('custom.hook', function () use($app) {
    echo '<hr>Test: custom.hook<hr>';
});
//Multi Application Mode
$app->setName('upfor');
$app = \Upfor\App::getInstance('upfor');
//Apply a hook
$app->applyHook('custom.hook');
$app->run();