Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Disable cache vor view in dev environment


I'm just searching for a way to disable .volt files cache for my dev environment.

Because everytime i modify a .volt file template, i have to 'rm app/cache/*'



Try this, or modify for your needs:

$di->set('view', function(){
    $view = new \Phalcon\Mvc\View();

            '.volt' => function($view, $di) {
            $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
              'compiledPath' => '../app/compiled/',
              'stat' => true,
              'compileAlways' => true  
            return $volt;

    return $view;

sometimes better solution is not to overcomplicate framework and use additional software, like incron: and when you update your .volt template, incron could 'rm app/cache/*' :)

If you need recursive incron, there is watcher:

Thanks @doit76 ! This is an usefull information :)

I solved it like this.

I added another parameter to config

'settings' => [
        'development'    => TRUE,

Then I just check for the parameter where the view component is setup to disable the cache completly while in development mode

$di->setShared('view', function () {
    $config = $this->getConfig();

    $view = new View();

        '.volt' => function ($view) {
            $config = $this->getConfig();

            $volt = new VoltEngine($view, $this);

            if($config->settings->development === false) {
                    'compiledPath' => $config->application->cacheDir,
                    'compiledSeparator' => '_',
                    'compileAlways' => true
            return $volt;
        '.phtml' => PhpEngine::class // php >= 5.5 only
        //'.phtml' => 'Phalcon\Mvc\View\Engine\Php' // php <= php 5.4 work-around


    return $view;

Another solution is found here: Where a person named Jason solved it by unlinking files and forcing volt to always compile the files