nic-d/slim3-mustache

Allows you to use Mustache in Slim 3.

dev-master 2017-05-25 05:05 UTC

This package is auto-updated.

Last update: 2024-05-22 09:01:29 UTC


README

Adds support for MustachePHP for rendering views in Slim 3.

Requirements

  • Slim 3.0.0 or newer;
  • PHP 5.6 or newer.

Install

composer require nic-d/slim3-mustache

How to use

// Instantiate Mustache and add to the container
$container['view'] = function ($container) {
    $view = new \Slim\Views\Mustache([
        'loader' => new Mustache_Loader_StringLoader(),
    ]);

    return $view;
};

You can also fetch the Mustache instance by using:

$container->get('view')->getMustache();

Testing

PHPUnit 6.0 or greater required.

phpunit