Boiler Template Engine for PHP

Boiler is a native PHP 8.1 template engine in the vein of Plates, which it is heavily inspired by. Like Plates, Boiler does not introduce a new template language and instead uses PHP itself. You simply use the PHP statements you already know.

The main differences to Plates are:

  • It automatically escapes strings and Stringable values. This is optional. You can turn it off globally or for single render calls.
  • The template context is global by default. That means all values available in the main template are available in all included parts, like sections, inserts or layouts.

Features

  • Autoescaping: Prevents XSS from untrusted user input by passing all rendererd strings to PHP's htmlspecialchars function.
  • A simple API. Only one class, the Engine, is usually needed.
  • Code reuse with template inheritance and inclusion.
  • You use plain PHP in your templates. No need to learn another syntax.
  • Fully tested and statically analyzed with Psalm set to level 1
    (disclaimer: reportMixedIssues is disabled).
  • Reasonable performance.

Next: Quick Start or The Engine.