PHPackages                             duon/boiler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. duon/boiler

ActiveLibrary[Templating &amp; Views](/categories/templating)

duon/boiler
===========

A PHP template engine that doesn't require you to learn a new syntax

0.2.0(1mo ago)01301MITPHPPHP ^8.5CI passing

Since Jan 25Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/duonrun/boiler)[ Packagist](https://packagist.org/packages/duon/boiler)[ Docs](https://duon.run/boiler)[ RSS](/packages/duon-boiler/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (7)Used By (1)

Boiler
======

[](#boiler)

[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)[![Codacy Badge](https://camo.githubusercontent.com/c01b2494259b774dc569800895c955b372b11cdd4f05c38aaffd037f49ee1133/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6131313435343832386237653437386238343764323931303238346237636639)](https://app.codacy.com/gh/duonrun/boiler/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)[![Codacy Badge](https://camo.githubusercontent.com/0084e67b738daf2bf5272132bfbf630edd623b888dad2b3e39ff901294e196a8/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f6131313435343832386237653437386238343764323931303238346237636639)](https://app.codacy.com/gh/duonrun/boiler/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)[![Psalm level](https://camo.githubusercontent.com/12a7cb91ac92e5dbb17472e4e5c83c59af2f3d546b0a89e196e13212c1baa368/68747470733a2f2f73686570686572642e6465762f6769746875622f64756f6e72756e2f626f696c65722f6c6576656c2e7376673f)](https://shepherd.dev/github/duonrun/boiler)[![Psalm coverage](https://camo.githubusercontent.com/5dc3021a0e78fcafdc27dffc7d43cdcd2b4de9b865e1e5b3c9417755a7518c89/68747470733a2f2f73686570686572642e6465762f6769746875622f64756f6e72756e2f626f696c65722f636f7665726167652e7376673f)](https://shepherd.dev/github/duonrun/boiler)

Boiler is a small template engine for PHP 8.5+, inspired by Plates. Like Plates, it uses native PHP as its templating language rather than introducing a custom syntax.

Key differences from Plates:

- Automatic escaping of strings and [Stringable](https://www.php.net/manual/en/class.stringable.php) values for enhanced security
- Global template context, making all variables accessible throughout the template

Other highlights:

- Layouts, inserts/partials, and sections (with append/prepend)
- Optional HTML sanitization via `symfony/html-sanitizer`
- Custom template methods and optional whitelisting of trusted value classes

Installation
------------

[](#installation)

```
composer require duon/boiler
```

Documentation
-------------

[](#documentation)

Start here: `docs/index.md`.

Quick start
-----------

[](#quick-start)

Consider this example directory structure:

```
path
`-- to
	`-- templates
		`-- page.php

```

Create a template file at `/path/to/templates/page.php` with this content:

```
ID
```

Then initialize the `Engine` and render your template:

```
use Duon\Boiler\Engine;

$engine = Engine::create('/path/to/templates');
$html = $engine->render('page', ['id' => 13]);

assert($html == 'ID 13');
```

Common patterns
---------------

[](#common-patterns)

Render from multiple directories (optionally with namespaces):

```
$engine = Engine::create([
	'theme' => '/path/to/theme',
	'app' => '/path/to/templates',
]);

// Renders the first match (theme overrides app)
$engine->render('page');

// Force a specific namespace
$engine->render('app:page');
```

Control escaping:

```
$engine = Engine::create('/path/to/templates');
$engine->render('page');
$engine->renderUnescaped('page');

$engine = Engine::unescaped('/path/to/templates');
$engine->render('page');
$engine->renderEscaped('page');
```

Template helpers available via `$this` inside templates:

- `$this->layout('layout')`
- `$this->insert('partial', ['value' => '...'])`
- `$this->begin('name')` / `$this->append('name')` / `$this->prepend('name')` / `$this->end()`
- `$this->section('name', 'default')` / `$this->has('name')`
- `$this->raw($value)` when you need the original value for comparisons or custom logic
- `$this->esc($value)` and `$this->clean($html)`

Run the tests
-------------

[](#run-the-tests)

```
composer test
composer check
composer mdlint
```

License
-------

[](#license)

This project is licensed under the [MIT license](LICENSE.md).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance89

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Total

4

Last Release

54d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c15f1690b643e5cbf205fd28f3b2ebb6c7448d34774bb92b7952150c901a689?d=identicon)[ernstla](/maintainers/ernstla)

---

Top Contributors

[![ernstla](https://avatars.githubusercontent.com/u/683620?v=4)](https://github.com/ernstla "ernstla (323 commits)")

---

Tags

templatingtemplatesduon

### Embed Badge

![Health badge](/badges/duon-boiler/health.svg)

```
[![Health](https://phpackages.com/badges/duon-boiler/health.svg)](https://phpackages.com/packages/duon-boiler)
```

###  Alternatives

[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k5.9M232](/packages/league-plates)[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[smarty/smarty

Smarty - the compiling PHP template engine

2.3k39.1M395](/packages/smarty-smarty)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)[shoot/shoot

Shoot aims to make providing data to your templates more manageable

40229.9k2](/packages/shoot-shoot)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
