PHP Slim View for PHP Plates.
- Uses the templates path variable from Slim.
- You can use the same functions as defined in package slim/views.
<?php
/**
* @var Composer\Autoload\ClassLoader $autoload
*/
$autoload = require 'vendor/autoload.php';
$app = new Slim\Slim();
$app->view(
new Slim\Views\Plates(function (League\Plates\Engine $engine) use ($app) {
$engine->loadExtension(new League\Plates\Extension\URI($app->request()->getPathInfo()));
$engine->loadExtension(new Slim\Views\PlatesExtension);
})
);
// routes...
$app->run();
version 1.0 requires plates 3.0. If you need to use 2.x, use 0.2. When installing, use * to determine which version to use.
{
"require": {
"slim/plates": "*"
}
}
and then
composer install
or
composer update -o
composer require slim/plates