2017 © Pedro Peláez
 

library slim-mustache-view

Mustache View package for the Slim Framework

image

lejahmie/slim-mustache-view

Mustache View package for the Slim Framework

  • Wednesday, February 15, 2017
  • by lejahmie
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Slim Mustache View

Mustache View package for the Slim Framework 3+, using bobthecow great PHP implementation of Mustache! ;-), (*1)

How to install

Using Composer

$ composer require lejahmie/slim-mustache-view

How to use

<?php
require 'vendor/autoload.php';

$app = new \Slim\Slim();
$container = $app->getContainer();
$container['view'] = function ($c) {
    $mustache = new \Slim\Mustache\Mustache(
        '/templates', // Template path
        array(
            'charset' => 'UTF-8',
        ),
        array(
            'extension' => '.html'
        )
    );
    return $mustache;
};
$app->get('/', function (Request $request, Response $response) {
    // The render method takes the reponse object,
    // template name and finally some data as an array.
    $response = $this->view->render($response, "hello", ["foo" => 'bar']);
    return $response;
});

Methods

render($templateName, $data)

Renders the Mustache template with the ResponseInterface used by Slim; $response->getBody()->write($output);, (*2)

getRenderedMarkup($templateName, $data)

Returns the renderd Mustache template as a string., (*3)

setTemplatePath($templatePath)

Set the template path where Mustache will look for template files., (*4)

setLoaderOptions($loaderOptions)

Set the options for Mustache filesystem loader. See; https://github.com/bobthecow/mustache.php/wiki/Template-Loading, (*5)

setOptions($options)

Set the Mustache options. See; https://github.com/bobthecow/mustache.php/wiki, (*6)

Authors

Jamie Telin, (*7)

License

The MIT License (MIT), (*8)

Change log

1.0.1

  • Added method getRenderedMarkup($templateName, $data) which allow to fetch the processed markup as raw html string.
  • Fixed some typos.
  • Better readme, because you all read this right? :-D

1.0

  • First version y'all!

The Versions

15/02 2017

dev-master

9999999-dev https://github.com/jahmie/slim-mustache-view

Mustache View package for the Slim Framework

  Sources   Download

MIT

The Requires

 

templating mustache slimphp view

15/02 2017

v2.0

2.0.0.0 https://github.com/jahmie/slim-mustache-view

Mustache View package for the Slim Framework

  Sources   Download

MIT

The Requires

 

templating mustache slimphp view

10/09 2016

v1.2

1.2.0.0 https://github.com/jahmie/slim-mustache-view

Mustache View package for the Slim Framework

  Sources   Download

MIT

The Requires

 

templating mustache slimphp view

10/09 2016

v1.1

1.1.0.0 https://github.com/jahmie/slim-mustache-view

Mustache View package for the Slim Framework

  Sources   Download

MIT

The Requires

 

templating mustache slimphp view

10/09 2016

v1.0

1.0.0.0 https://github.com/jahmie/slim-mustache-view

Mustache View package for the Slim Framework

  Sources   Download

MIT

The Requires

 

templating mustache slimphp view