2017 © Pedro Peláez
 

library mustache

A Mustache implementation in PHP.

image

mustache/mustache

A Mustache implementation in PHP.

  • Friday, December 8, 2017
  • by bobthecow
  • Repository
  • 135 Watchers
  • 2684 Stars
  • 3,735,072 Installations
  • PHP
  • 280 Dependents
  • 30 Suggesters
  • 383 Forks
  • 32 Open issues
  • 26 Versions
  • 6 % Grown

The README.md

Mustache.php

A Mustache implementation in PHP., (*1)

Package version Monthly downloads, (*2)

Installation

composer require mustache/mustache

Usage

A quick example:, (*3)

<?php
$m = new \Mustache\Engine(['entity_flags' => ENT_QUOTES]);
echo $m->render('Hello {{planet}}', ['planet' => 'World!']); // "Hello World!"

And a more in-depth example -- this is the canonical Mustache template:, (*4)

```html+jinja Hello {{name}} You have just won {{value}} dollars! {{#in_ca}} Well, {{taxed_value}} dollars, after taxes. {{/in_ca}}, (*5)



Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well: ```php <?php class Chris { public $name = "Chris"; public $value = 10000; public function taxed_value() { return $this->value - ($this->value * 0.4); } public $in_ca = true; }

And render it:, (*6)

<?php
$m = new \Mustache\Engine(['entity_flags' => ENT_QUOTES]);
$chris = new \Chris;
echo $m->render($template, $chris);

Note: we recommend using ENT_QUOTES as a default of entity_flags to decrease the chance of Cross-site scripting vulnerability., (*7)

And That's Not All!

Read the Mustache.php documentation for more information., (*8)

Upgrading from v2.x

Mustache.php v3.x drops support for PHP 5.2–5.5, but is otherwise backwards compatible with v2.x., (*9)

To ease the transition, previous behavior can be preserved via configuration:, (*10)

  • The strict_callables config option now defaults to true. Lambda sections should use closures or callable objects. To continue supporting array-style callables for lambda sections (e.g. [$this, 'foo']), set strict_callables to false.
  • A context shadowing bug from v2.x has been fixed, but if you depend on the previous buggy behavior you can preserve it via the buggy_property_shadowing config option.
  • By default the return value of higher-order sections that are rendered via the lambda helper will no longer be double-rendered. To preserve the previous behavior, set double_render_lambdas to true. This is not recommended.

In order to maintain a wide PHP version support range, there are minor changes to a few interfaces, which you might need to handle if you extend Mustache (see c0453be)., (*11)

See Also

The Versions

08/12 2017

dev-dev

dev-dev https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

11/07 2017

dev-master

9999999-dev https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

11/07 2017

v2.12.0

2.12.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

31/07 2016

v2.11.1

2.11.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

31/07 2016

v2.11.0

2.11.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

08/04 2016

dev-feature/production-filesystem-loader

dev-feature/production-filesystem-loader https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

27/02 2016

v2.10.0

2.10.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

15/08 2015

v2.9.0

2.9.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

01/04 2015

v2.8.0

2.8.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

03/03 2015

dev-tmp/template-inheritance-whitespace

dev-tmp/template-inheritance-whitespace https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

26/08 2014

v2.7.0

2.7.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

20/06 2014

v2.6.1

2.6.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

14/04 2014

v2.6.0

2.6.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

09/01 2014

v2.5.1

2.5.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

14/12 2013

v2.5.0

2.5.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

13/08 2013

1.0.0

1.0.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

13/08 2013

v2.4.1

2.4.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

18/07 2013

v2.4.0

2.4.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

25/04 2013

v2.3.1

2.3.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

02/04 2013

v2.3.0

2.3.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

25/03 2013

v2.2.0

2.2.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

12/01 2013

v2.1.0

2.1.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

12/09 2012

v2.0.2

2.0.2.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

12/09 2012

v2.0.1

2.0.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

09/07 2012

v2.0.0

2.0.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

13/06 2012

v2.0.0-rc.1

2.0.0.0-RC1 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache