Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 10-Nov-2020 | - | ||||
src/Mustache/ | H | 10-Nov-2020 | - | 4,650 | 2,038 | |
.php_cs | H A D | 09-Nov-2020 | 569 | 27 | 22 | |
.styleci.yml | H A D | 09-Nov-2020 | 198 | 14 | 11 | |
CONTRIBUTING.md | H A D | 09-Nov-2020 | 1.8 KiB | 36 | 21 | |
LICENSE | H A D | 09-Nov-2020 | 1.1 KiB | 22 | 17 | |
README.md | H A D | 09-Nov-2020 | 1.8 KiB | 73 | 49 | |
composer.json | H A D | 09-Nov-2020 | 657 | 26 | 25 |
README.md
1Mustache.php 2============ 3 4A [Mustache](http://mustache.github.com/) implementation in PHP. 5 6[](https://packagist.org/packages/mustache/mustache) 7[](http://travis-ci.org/bobthecow/mustache.php) 8[](https://styleci.io/repos/569670) 9[](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