Cached view template path resolver to speed up the ZF2 view layer by avoiding stat calls

4.1.0 2017-12-01 18:09 UTC

This package is auto-updated.

Last update: 2020-11-09 21:42:36 UTC


OcraCachedViewResolver is performance-oriented Zend Framework 2 Module that increases performance in your application by caching the process of resolving template names to template paths.

In ZF3, the process of resolving template paths causes a lot of stat calls. This module adds a cache layer to avoid that.

Tests Releases Downloads Dependencies
Build Status Code Coverage Scrutinizer Quality Score Latest Stable Version Latest Unstable Version Total Downloads Dependency Status


The recommended way to install ocramius/ocra-cached-view-resolver is through composer:

php composer.phar require ocramius/ocra-cached-view-resolver:3.0.*

If you use legacy/outdated PHP versions, such as 5.5.x and 5.6.x, you can use any 3.x version of ocramius/ocra-cached-view-resolver.

You can then enable the module in your config/application.config.php by adding 'OcraCachedViewResolver' to the 'modules' section.


Default configurations are provided in config/ocra-cached-view-resolver.local.php.dist. You can copy it to your application's config/autoload directory and remove the .dist extension from the file name.

Note that without this file (or similar configuration), OcraCachedViewResolver will use a so-called "blackhole" cache that doesn't actually cache anything. The provided .dist config file assumes that you have the APC extension installed: if that is not the case, please tweak this file.