Skip to content

fiveorbs/boiler

Repository files navigation

Boiler

Software License Codacy Badge Codacy Badge Psalm level Psalm coverage

Warning

This template engine is under active development, so some of the features listed and parts of the documentation may be still experimental, subject to change, or missing.

Boiler is a template engine for PHP 8.2 and above, 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 values for enhanced security
  • Global template context, making all variables accessible throughout the template

Installation

composer require fiveorbs/boiler

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:

<p>ID <?= $id ?></p>

Then initialize the Engine and render your template:

use FiveOrbs\Boiler\Engine;

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

assert($html == '<p>ID 13</p>');

Run the tests

phpunit --testdox && \
	psalm --no-cache --show-info=true && \
	phpcs -s -p --ignore=tests/templates src tests

License

Boiler is available under the MIT license.

Copyright © 2022-2024 ebene fünf GmbH. All rights reserved.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published