PHPackages                             danjam/slim-mustache-view - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. danjam/slim-mustache-view

ActiveLibrary[Framework](/categories/framework)

danjam/slim-mustache-view
=========================

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

1.1.2(9y ago)579.2k—3.9%11MITPHPPHP &gt;=5.5.0CI failing

Since Aug 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/danjam/slim-mustache-view)[ Packagist](https://packagist.org/packages/danjam/slim-mustache-view)[ Docs](https://github.com/danjam/slim-mustache-view)[ RSS](/packages/danjam-slim-mustache-view/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (5)Used By (1)

slim-mustache-view
==================

[](#slim-mustache-view)

[![Build Status](https://camo.githubusercontent.com/eda780eb083f6efa0eaf117477a8aa222b0595c6ac6299472dbdf64c64bd88ab/68747470733a2f2f7472617669732d63692e6f72672f64616e6a616d2f736c696d2d6d757374616368652d766965772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/danjam/slim-mustache-view) [![Latest Stable Version](https://camo.githubusercontent.com/517bc1a2f0f43d9789cd802a2b6b4953be618e9d2525a9d1ac2b57ed67111c1e/68747470733a2f2f706f7365722e707567782e6f72672f64616e6a616d2f736c696d2d6d757374616368652d766965772f762f737461626c65)](https://packagist.org/packages/danjam/slim-mustache-view) [![Coverage Status](https://camo.githubusercontent.com/b8e29015a101cb327f40230403c1815beb020089bf90d2940bab6dde028c1003/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f64616e6a616d2f736c696d2d6d757374616368652d766965772f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/danjam/slim-mustache-view?branch=master) [![SensioLabsInsight](https://camo.githubusercontent.com/83a10aee177c26d6c27109fda3a8de11c766501d66f8c36a278854568f25d0a2/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f32626235313838302d376130652d343733362d616235632d3030393435326662343631342f6d696e692e706e67)](https://insight.sensiolabs.com/projects/2bb51880-7a0e-4736-ab5c-009452fb4614)

Simple [Slim 3 framework](https://github.com/slimphp/Slim) view renderer for [mustache](http://mustache.github.io/mustache.5.html) templates using [Mustache.php](https://github.com/bobthecow/mustache.php)

Install
-------

[](#install)

Via [Composer](https://getcomposer.org/)

```
$ composer require danjam/slim-mustache-view
```

Usage
-----

[](#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](https://github.com/bobthecow/mustache.php/wiki#constructor-options) for details.

```
// 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](https://github.com/janl/mustache.js/)

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

Testing
-------

[](#testing)

```
phpunit
```

Credits
-------

[](#credits)

- [Danny James](https://github.com/danjam)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Total

4

Last Release

3438d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab7117085b0953f370a4f79432658f65f17f393c1f0342fd77558c184f78f1dc?d=identicon)[danjam](/maintainers/danjam)

---

Top Contributors

[![danjam](https://avatars.githubusercontent.com/u/3920749?v=4)](https://github.com/danjam "danjam (24 commits)")

---

Tags

frameworkmustachephpslimtemplateframeworkslimtemplatemustacheview

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/danjam-slim-mustache-view/health.svg)

```
[![Health](https://phpackages.com/badges/danjam-slim-mustache-view/health.svg)](https://phpackages.com/packages/danjam-slim-mustache-view)
```

###  Alternatives

[slim/twig-view

Slim Framework 4 view helper built on top of the Twig 3 templating component

3708.0M210](/packages/slim-twig-view)[slim/php-view

Render PHP view scripts into a PSR-7 Response object.

2739.7M95](/packages/slim-php-view)[mathmarques/smarty-view

Slim Framework 4 view helper built on top of the Smarty templating component

24134.7k1](/packages/mathmarques-smarty-view)[rubellum/slim-blade-view

Slim Framework 3 view helper built on the Blade component

1822.4k2](/packages/rubellum-slim-blade-view)[projek-xyz/slim-plates

Render your Slim 3 application views using Plates template engine.

2678.2k3](/packages/projek-xyz-slim-plates)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
