Home — v1.x - bobthecow/mustache.php GitHub Wiki
Mustache is a simple, logic-less template engine.
We call it "logic-less" because there are no if
statements, else
clauses, or for
loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values.
Prerequisites
Mustache.php requires at least PHP 5.2.x to run.
Installation
Download the latest release as a zip, check out the Git repo as a submodule to your project, or simply copy the single Mustache.php file into your project directory.
Basic usage
Setup
First, you need to load the class into your project:
<?php
require_once '/path/to/project/mustache/Mustache.php';
There's no step two, really.
What are you waiting for?
<?php
$m = new Mustache;
echo $m->render('Hello, {{planet}}!', array('planet' => 'World')); // "Hello, world!"