Skip to content

Mustache.php v3.0.0

Latest
Compare
Choose a tag to compare
@bobthecow bobthecow released this 28 Jun 18:31
· 1 commit to main since this release

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

To ease the transition, previous behavior can be preserved via configuration:

  • 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.

Note

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).

New

  • \Mustache_Engine and other prefixed classnames are all available as \Mustache\Engine, etc. You can keep using the old style for now, if you feel nostalgic for 2008, but you'll want to update eventually.
  • Adds support for the Mustache dynamic tag names spec for partials and interpolation.

Improved

  • The {{% BLOCKS }} pragma is now part of the Mustache spec, and is enabled by default.
  • Optional Mustache specs (lambdas, inheritance, and dynamic_names) can now be disabled via config options.
  • No more warnings or errors in PHP 8.x (thanks @reedy, @swissspidy, and everyone else who helped with this!).
  • Improved resolution of complicated combinations of filters, dotted name lookups, and lambdas.
  • Remove autoloader implementation. Just use Composer.