示例#1
0
文件: index.php 项目: aeshion/ZeroPHP
 * Created by PhpStorm.
 * User: tachigo
 * Date: 16-8-23
 * Time: 下午3:12
 */
use Symfony\Component\Yaml\Yaml;
use Zero\Component\Kernel\AppKernel;
require '../../config/config.http.php';
define('CACHE_ROOT', APP_ROOT . '/cache');
// 配置文件地址
$kernel = new AppKernel(Yaml::parse(file_get_contents(APP_ROOT . '/config/config.' . ENTRY . '.yml')));
$configuration = $kernel->getConfiguration();
// yml格式的配置文件解析器
$yml_configuration_parser = function ($path) {
    if ($path) {
        return Yaml::parse(file_get_contents($path));
    }
    return array();
};
$modules = array(new \Zero\Module\Zero\Http\ZeroHttpModule($yml_configuration_parser), new \Zero\Module\Zero\Twig\ZeroTwigModule($yml_configuration_parser), new \Zero\Module\Metronic\AssetsModule\MetronicAssetsModule($yml_configuration_parser), new \Zero\Module\Metronic\AdminModule\MetronicAdminModule($yml_configuration_parser), new \Tachigo\Database\TachigoDatabaseModule($yml_configuration_parser), new \Tachigo\Admin\TachigoAdminModule($yml_configuration_parser), new \Tachigo\User\TachigoUserAdmin($yml_configuration_parser), new \Tachigo\User\TachigoUserAware($yml_configuration_parser), new \Tachigo\WWW\TachigoWWWAdmin($yml_configuration_parser), new \Tachigo\Forum\TachigoForumAdmin($yml_configuration_parser), new \Tachigo\Game\TachigoGameAdmin($yml_configuration_parser), new \Tachigo\TinyMCE\TachigoTinyMCEModule($yml_configuration_parser));
foreach ($modules as $module) {
    $configuration->merge($module());
    $kernel->registerModule($module);
}
$kernel->initAppServiceContainer('TachigoAdminServiceContainer');
$app_container = $kernel->getAppServiceContainer();
$app_container->bootstrapKernel($kernel);
$app_container->tag('debugger');
// 这个地方开始自行调用接收请求的逻辑
\Zero\Component\Kernel\HttpProcessor::process($app_container);
示例#2
0
 public function bootstrapKernel(AppKernel $kernel)
 {
     HttpProcessor::bootstrapKernel($kernel);
 }