assouan/template

Template attribute renderer for HTTP controllers.

Maintainers

Package info

github.com/assouan/template

pkg:composer/assouan/template

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

dev-main / 0.1.x-dev 2026-06-21 10:32 UTC

This package is auto-updated.

Last update: 2026-06-21 10:32:34 UTC


README

Template attribute renderer for HTTP controllers.

composer require assouan/template

Requires PHP 8.5 or later.

Inside a .phtml template, three small helpers are available:

<?=$html($title)?>      // HTML text
<?=$lines($body)?>      // HTML text with newlines
<?=$url($slug)?>        // URL path segment

A template can opt into a layout file by setting $layout:

<?php
$layout = ['file' => 'Layout.phtml', 'title' => 'Home'];
$status = 200;
?>

<h1><?=$html($title)?></h1>

The layout receives $body, the layout array values, and the same helpers.

Templates may set $status when the rendered response should use a specific HTTP code, for example a layout-backed 404 page.