Exemple #1
0
 /**
  * Setting up the view component
  */
 $di->set('view', function () {
     $view = new View();
     $view->setViewsDir(APP_DIR . 'views/');
     $view->registerEngines(array('.volt' => function ($view, $di) {
         $env = $di->get('config')->get('environment');
         /** @var ViewInterface|View $view */
         $volt = new Volt($view, $di);
         $volt->setOptions(array('compiledPath' => function ($templatePath) use($view) {
             $dir = rtrim(sys_get_temp_dir(), '/') . '/volt-cache';
             if (!is_dir($dir)) {
                 mkdir($dir);
             }
             return $dir . '/hunter-light%' . str_replace('/', '%', str_replace($view->getViewsDir(), '', $templatePath)) . '.php';
         }, 'compileAlways' => $env->realm != 'prod'));
         return $volt;
     }));
     return $view;
 }, true);
 /**
  * Setting up the asset manager
  */
 $di->set('assets', function () {
     $assetManager = new AssetManager();
     return $assetManager;
 }, true);
 /**
  * Setting up the model cache
  */