1Mustache.php
2============
3
4A [Mustache](http://mustache.github.com/) implementation in PHP.
5
6[![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
7[![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php)
8[![StyleCI](https://styleci.io/repos/569670/shield)](https://styleci.io/repos/569670)
9[![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
10
11
12Usage
13-----
14
15A quick example:
16
17```php
18<?php
19$m = new Mustache_Engine;
20echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
21```
22
23
24And a more in-depth example -- this is the canonical Mustache template:
25
26```html+jinja
27Hello {{name}}
28You have just won {{value}} dollars!
29{{#in_ca}}
30Well, {{taxed_value}} dollars, after taxes.
31{{/in_ca}}
32```
33
34
35Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well:
36
37```php
38<?php
39class Chris {
40    public $name  = "Chris";
41    public $value = 10000;
42
43    public function taxed_value() {
44        return $this->value - ($this->value * 0.4);
45    }
46
47    public $in_ca = true;
48}
49```
50
51
52And render it:
53
54```php
55<?php
56$m = new Mustache_Engine;
57$chris = new Chris;
58echo $m->render($template, $chris);
59```
60
61
62And That's Not All!
63-------------------
64
65Read [the Mustache.php documentation](https://github.com/bobthecow/mustache.php/wiki/Home) for more information.
66
67
68See Also
69--------
70
71 * [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md).
72 * [mustache(5)](http://mustache.github.com/mustache.5.html) man page.
73