/** * Callback for 'boot' event. */ public function boot(Event $event, Application $app) { if (!is_dir($app['path.cache']) && !mkdir($app['path.cache'], 0777, true)) { throw new \RuntimeException(sprintf('Unable to create cache folder in "%s"', $app['path.cache'])); } $this->init(); $app->trigger('init', array($app)); $app['yii']->on(\yii\web\View::EVENT_BEGIN_BODY, function () use($app) { $app->trigger('view', array($app)); }); }