slim/plates

Plates View (native php) package for the Slim Framework

v1.0.2 2015-08-31 18:38 UTC

This package is not auto-updated.

Last update: 2024-04-13 14:02:36 UTC


README

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.

Example

<?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();

installation

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.

via composer.json:

{
    "require": {
        "slim/plates": "*"
    }
}

and then

composer install

or

composer update -o

via command line

composer require slim/plates