PHPackages                             pattern-lab/patternengine-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pattern-lab/patternengine-mustache

AbandonedArchivedPatternlab-patternengine[Utility &amp; Helpers](/categories/utility)

pattern-lab/patternengine-mustache
==================================

Mustache-based PatternEngine for Pattern Lab.

v2.1.0(9y ago)056.0k—6.7%1[1 issues](https://github.com/pattern-lab/patternengine-php-mustache/issues)7MITPHP

Since May 6Pushed 8y ago3 watchersCompare

[ Source](https://github.com/pattern-lab/patternengine-php-mustache)[ Packagist](https://packagist.org/packages/pattern-lab/patternengine-mustache)[ Docs](http://patternlab.io)[ RSS](/packages/pattern-lab-patternengine-mustache/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (6)Used By (7)

[![license](https://camo.githubusercontent.com/7b07272d5e4c6889b468bb18852e3c0454d6cdd18f308d64960dd48d919ebab8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7061747465726e2d6c61622f7061747465726e656e67696e652d7068702d6d757374616368652e7376673f6d61784167653d32353932303030)](https://camo.githubusercontent.com/7b07272d5e4c6889b468bb18852e3c0454d6cdd18f308d64960dd48d919ebab8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7061747465726e2d6c61622f7061747465726e656e67696e652d7068702d6d757374616368652e7376673f6d61784167653d32353932303030)[![Packagist](https://camo.githubusercontent.com/26708ff955224c19b7400eb82b7de3e6f86c872527df3a10718f78460806ab09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061747465726e2d6c61622f7061747465726e656e67696e652d6d757374616368652e7376673f6d61784167653d32353932303030)](https://packagist.org/packages/pattern-lab/patternengine-mustache) [![Gitter](https://camo.githubusercontent.com/f577e37eeef61fbb13b53db1e484a34b084cdb41d4c43a6739cc51297b39b350/68747470733a2f2f696d672e736869656c64732e696f2f6769747465722f726f6f6d2f7061747465726e2d6c61622f7068702e7376673f6d61784167653d32353932303030)](https://gitter.im/pattern-lab/php)

Mustache PatternEngine for Pattern Lab PHP
==========================================

[](#mustache-patternengine-for-pattern-lab-php)

The Mustache PatternEngine allows you to use [Mustache](https://mustache.github.io) as the template language for Pattern Lab PHP. Once the PatternEngine is installed you can use Mustache-based StarterKits and StyleguideKits.

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

[](#installation)

The Mustache PatternEngine will come pre-installed with the **Pattern Lab Standard Edition**.

### Composer

[](#composer)

Pattern Lab PHP uses [Composer](https://getcomposer.org/) to manage project dependencies with Pattern Lab Editions. To add the Mustache PatternEngine to the dependencies list for your Edition you can type the following in the command line at the base of your project:

```
composer require pattern-lab/patternengine-mustache

```

See Packagist for [information on the latest release](https://packagist.org/packages/pattern-lab/patternengine-mustache).

Overview
--------

[](#overview)

This document is broken into two parts:

- [Extending Mustache](#extending-mustache)
- [Available Loaders for Plugin Developers](#available-loaders)

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

[](#extending-mustache)

Mustache comes with two ways to extend the underlying template parser:

- [Filters](https://github.com/bobthecow/mustache.php/wiki/FILTERS-pragma)
- Lambdas

The Mustache PatternEngine enables these features via Helpers.

### Helpers

[](#helpers)

The requirements for using helpers with Pattern Lab:

- Files must go in `./source/_mustache-components/helpers`
- Files must have the extension `.helper.php` (*this can be modified in the config*)
- The helper **must** set the variable `$helper`
- Only one helper per file (*e.g. can only set `$helper` once per file*)

An example function called `verbatim.helper.mustache` in `./source/_mustache-components/helpers`:

```

```

This helper would be used like this in a pattern. Note that the tag is using the filename and that this is an example of a lambda:

```
{{# verbatim }}
  {{ this won't be parsed }}
{{/ verbatim }}
```

Mustache also allows dot notation with helpers. An example function called `case.helper.mustache` in `./source/_mustache-components/helpers`:

```
