2017 © Pedro Peláez
 

library slim-mustache-view

Simple Slim 3 framework view renderer for mustache templates using Mustache.php

image

danjam/slim-mustache-view

Simple Slim 3 framework view renderer for mustache templates using Mustache.php

  • Thursday, May 24, 2018
  • by danjam
  • Repository
  • 1 Watchers
  • 3 Stars
  • 303 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 17 % Grown

The README.md

slim-mustache-view

Build Status Latest Stable Version Coverage Status SensioLabsInsight, (*1)

Simple Slim 3 framework view renderer for mustache templates using Mustache.php, (*2)

Install

Via Composer, (*3)

$ composer require danjam/slim-mustache-view

Usage

// create Slim 3 app
$app = new \Slim\App();

// get the container
$container = $app->getContainer();

// register Mustache view
$container['view'] = function ($container) {
    $view = new \Slim\Views\Mustache();

    return $view;
};

// define the route
$app->get('/hello/{name}', function ($request, $response, $args) {
    return $this->view->render($response, 'Hello, {{name}}', [
        'name' => $args['name']
    ]);
});

// run the app
$app->run();

The constructor takes an optional array of Mustache.php options. See the Mustache.php documentation for details., (*4)

// register Mustache view
$container['view'] = function () {
    $view = new \Slim\Views\Mustache([
        'cache' => './cache/mustache',
        'loader' => new Mustache_Loader_FilesystemLoader('./views'),
        'partials_loader' => new Mustache_Loader_FilesystemLoader('./views/partials')
    ]);

    return $view;
};

You can also capture raw template contents if needed. This can be useful for rendering inline templates, for example when also using mustache.js, (*5)

$this->view->getRawTemplate('some-template.html');

Testing

phpunit

Credits

License

The MIT License (MIT). Please see License File for more information., (*6)

The Versions

24/05 2018

dev-master

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

Simple Slim 3 framework view renderer for mustache templates using Mustache.php

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template mustache slim view

19/12 2016

1.1.2

1.1.2.0 https://github.com/danjam/slim-mustache-view

Simple Slim 3 framework view renderer for mustache templates using Mustache.php

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template mustache slim view

27/08 2016

1.1.1

1.1.1.0 https://github.com/danjam/slim-mustache-view

Simple Slim 3 framework view renderer for mustache templates using Mustache.php

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template mustache slim view

27/08 2016

1.1.0

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

Simple Slim 3 framework view renderer for mustache templates using Mustache.php

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template mustache slim view

25/08 2016

1.0.0

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

Slim Framework 3 view helper for mustache.php

  Sources   Download

MIT

The Requires

 

The Development Requires

framework template mustache slim view