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.
- Host: GitHub
- URL: https://github.com/nicdavies/slim3-mustache
- Owner: nicdavies
- License: mit
- Created: 2017-05-24T07:36:43.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-25T05:05:42.000Z (about 9 years ago)
- Last Synced: 2024-04-21T10:15:03.355Z (about 2 years ago)
- Topics: framework, mustache, slim, slim3
- Language: PHP
- Size: 4.88 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
```