PHPackages                             packfire/mustache - 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. [Templating &amp; Views](/categories/templating)
4. /
5. packfire/mustache

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

packfire/mustache
=================

PHP Mustache Implementation

1.2.4(12y ago)24631BSD-3-ClausePHPPHP &gt;=5.3.0

Since May 24Pushed 12y ago1 watchersCompare

[ Source](https://github.com/packfire/mustache)[ Packagist](https://packagist.org/packages/packfire/mustache)[ RSS](/packages/packfire-mustache/feed)WikiDiscussions master Synced today

READMEChangelog (10)DependenciesVersions (15)Used By (1)

[![Packfire Mustache](https://camo.githubusercontent.com/d8c8cd1f2e27a078920b10caab556ec20e512753e03c3bc62cdc13bb52775edd/687474703a2f2f692e696d6775722e636f6d2f48516f33612e706e67)](https://camo.githubusercontent.com/d8c8cd1f2e27a078920b10caab556ec20e512753e03c3bc62cdc13bb52775edd/687474703a2f2f692e696d6775722e636f6d2f48516f33612e706e67)

Packfire Mustache is a lightweight Mustache implementation for Packfire. Prior to the adoptation of Mustache, Packfire has used a simple token-replace templating engine that uses single curly braces to indicate tokens.

```

  {title}

{message}

```

However, the simple templating parser is way too primitive and does not support nesting and listing like Mustache does. Hence, Packfire adopted the Mustache templating engine as its default templating engine.

However, the [PHP Mustache implementation](https://github.com/bobthecow/mustache.php) by [bobthecow](https://github.com/bobthecow) was found to be too heavy and thus I decided to come up with our own. Mustache has been tested against the provided spec tests.

Packfire Mustache uses double curly braces to indicate tokens, supports escaping by default and supports nested block tokens:

```
Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
    Well, ${{taxed_value}}, after taxes.
{{/in_ca}}

```

To find out more about how Packfire Mustache works you can refer to the [original Mustache manual](http://mustache.github.com/mustache.5.html) as Mustache is designed to be platform-independent and cross-platform compatible.

\##Installation

[Packfire Mustache](https://packagist.org/packages/packfire/mustache) can be installed via [Composer](https://getcomposer.org/):

```
{
	"require": {
		"packfire/mustache": "1.0.*"
	}
}

```

Then run the Composer installation command:

```
$ composer install

```

\##Usage

A quick example:

```
use Packfire\Template\Mustache\Mustache;

$m = new Mustache('Hello {{planet}}!');
echo $m->parameters(array('planet' => 'World'))->render();
// "Hello World!"

```

And a more in-depth example--this is the canonical Mustache template:

```
Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
    Well, ${{taxed_value}}, after taxes.
{{/in_ca}}

```

Along with the associated `Mustache` class:

```
use Packfire\Template\Mustache\Mustache;

class Chris extends Mustache {
    public $name = "Chris";
    public $value = 10000;

    public function taxed_value() {
        return $this->value - ($this->value * 0.4);
    }

    public $in_ca = true;
}

```

Render it like so:

```
$chris = new Chris;
echo $chris->template($template)->render();

```

Here's the same thing, a different way:

Create a view object--which could also be an associative array, but those don't do functions quite as well:

```
class Chris {
    public $name = "Chris";
    public $value = 10000;

    public function taxed_value() {
        return $this->value - ($this->value * 0.4);
    }

    public $in_ca = true;
}

```

And render it:

```
use Packfire\Template\Mustache\Mustache;

$chris = new Chris();
$m = new Mustache();
echo $m->template($template)->parameters($chris)->render();

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

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 ~25 days

Recently: every ~38 days

Total

13

Last Release

4479d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1743cee8bb3242229368d7fca5a7ac952932fd377d0c3d4343eb8dceea6a395e?d=identicon)[mauris](/maintainers/mauris)

---

Top Contributors

[![mauris](https://avatars.githubusercontent.com/u/996939?v=4)](https://github.com/mauris "mauris (151 commits)")

### Embed Badge

![Health badge](/badges/packfire-mustache/health.svg)

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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