An open API service indexing awesome lists of open source software.

https://github.com/nicdavies/slim3-mustache

Allows you to use Mustache in Slim 3.
https://github.com/nicdavies/slim3-mustache

framework mustache slim slim3

Last synced: 5 months ago
JSON representation

Allows you to use Mustache in Slim 3.

Awesome Lists containing this project

README

          

# Slim 3 Mustache
Adds support for [MustachePHP](https://github.com/bobthecow/mustache.php) for rendering views in Slim 3.

## Requirements
* [Slim](http://www.slimframework.com/) 3.0.0 or newer;
* [PHP](http://www.php.net/) 5.6 or newer.

## Install
```
composer require nic-d/slim3-mustache
```

## How to use
```php
// 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:
```php
$container->get('view')->getMustache();
```

## Testing
PHPUnit 6.0 or greater required.

```
phpunit
```