PHPackages                             blue-tomato/template-engine-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. blue-tomato/template-engine-mustache

AbandonedArchivedPw-module

blue-tomato/template-engine-mustache
====================================

ProcessWire module adding Mustache to the TemplateEngineFactory

2.0.0(7y ago)215MITPHPPHP &gt;=7.0

Since Feb 28Pushed 7y ago2 watchersCompare

[ Source](https://github.com/blue-tomato/TemplateEngineMustache)[ Packagist](https://packagist.org/packages/blue-tomato/template-engine-mustache)[ Docs](https://github.com/blue-tomato/TemplateEngineMustache)[ RSS](/packages/blue-tomato-template-engine-mustache/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (4)Versions (2)Used By (0)

TemplateEngineMustache
======================

[](#templateenginemustache)

[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)[![ProcessWire 3](https://camo.githubusercontent.com/34449e2237c61f5c40a0cbf06273d9f22ee4b9ba45442c77b6554c874927b1ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50726f63657373576972652d332e782d6f72616e67652e737667)](https://github.com/processwire/processwire)

A ProcessWire module adding Mustache to the [TemplateEngineFactory](https://github.com/wanze/TemplateEngineFactory).

Requirements
------------

[](#requirements)

- ProcessWire `3.0` or newer
- TemplateEngineFactory `2.0` or newer
- PHP `7.0` or newer
- Composer

> The `1.x` version of this module is available on the [1.x branch](https://github.com/blue-tomato/TemplateEngineMustache/tree/1.x). Use this version if you still use *TemplateEngineFactory* `1.x`.

Installation
------------

[](#installation)

Execute the following command in the root directory of your ProcessWire installation:

```
composer require blue-tomato/template-engine-mustache:^2.0

```

This will install the *TemplateEngineMustache* and *TemplateEngineFactory* modules in one step. Afterwards, don't forget to enable Mustache as engine in the *TemplateEngineFactory* module's configuration.

> ℹ️ This module includes test dependencies. If you are installing on production with `composer install`, make sure to pass the `--no-dev` flag to omit autoloading any unnecessary test dependencies!.

Configuration
-------------

[](#configuration)

The module offers the following configuration:

- **`Template files suffix`** The suffix of the Twig template files, defaults to `mustache`.
- **`Provide ProcessWire API variables in Mustache templates`** API variables (`$pages`, `$input`, `$config`...) are accessible in Twig, e.g. `{{ config }}` for the config API variable.
- **`Debug`** If enabled, Mustache outputs debug information.

Extending Mustache
------------------

[](#extending-mustache)

It is possible to extend Mustache after it has been initialized by the module. Hook the method `TemplateEngineMustache::initMustache`to register custom functions, extensions, global variables, filters etc.

Here is an example how you can use the provided hook to attach a custom function.

```
wire()->addHookAfter('TemplateEngineMustache::initMustache', function (HookEvent $event) {
    /** @var \Mustache_Engine $mustache */
    $mustache = $event->arguments('mustache');

    $mustache->setHelpers([
			'myHelperFunction' => function($text) {
				return trim($text);
			}
		]);
});

// ... and then use it anywhere in a Mustache template:

{{#myHelperFunction}} {{someVariable}} {{/myHelperFunction}}
```

> The above hook can be put in your `site/init.php` file. If you prefer to use modules, put it into the module's `init()`method and make sure that the module is auto loaded.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2627d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5abb5289c0233a035c7a5d1fcd6b741734c640911eff18d86b781ff6e5caea22?d=identicon)[blue-tomato](/maintainers/blue-tomato)

---

Top Contributors

[![tiefenb](https://avatars.githubusercontent.com/u/488163?v=4)](https://github.com/tiefenb "tiefenb (2 commits)")

---

Tags

processwiresmartysmarty-engine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/blue-tomato-template-engine-mustache/health.svg)

```
[![Health](https://phpackages.com/badges/blue-tomato-template-engine-mustache/health.svg)](https://phpackages.com/packages/blue-tomato-template-engine-mustache)
```

###  Alternatives

[composer/installers

A multi-framework Composer library installer

1.4k136.0M6.0k](/packages/composer-installers)[ytake/laravel-smarty

Smarty template engine for Laravel and Lumen

87401.6k](/packages/ytake-laravel-smarty)[wanze/template-engine-twig

ProcessWire module adding Twig to the TemplateEngineFactory

128.1k](/packages/wanze-template-engine-twig)

PHPackages © 2026

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