Using Plates

Plates is a native PHP template system maintained by The League of Extraordinary Packages. it provides:

We provide a TemplateRendererInterface wrapper for Plates via Zend\Expressive\Plates\PlatesRenderer.

Installing Plates

To use the Plates wrapper, you must install the Plates integration:

$ composer require zendframework/zend-expressive-platesrenderer

Using the wrapper

If instantiated without arguments, Zend\Expressive\Plates\PlatesRenderer will create an instance of the Plates engine, which it will then proxy to.

use Zend\Expressive\Plates\PlatesRenderer;

$renderer = new PlatesRenderer();

Alternately, you can instantiate and configure the engine yourself, and pass it to the Zend\Expressive\Plates\PlatesRenderer constructor:

use League\Plates\Engine as PlatesEngine;
use Zend\Expressive\Plates\PlatesRenderer;

// Create the engine instance:
$plates = new PlatesEngine();

// Configure it:
$plates->addFolder('error', 'templates/error/');
$plates->loadExtension(new CustomExtension();

// Inject:
$renderer = new PlatesRenderer($plates);