No eval()
Every expression runs through a recursive grammar parser instead of preg_replace code generation. Function calls, "::" and method calls are categorically excluded.
PHP Template Engine
A lightweight PHP template engine that cleanly separates logic from presentation – no eval(), strict auto-escaping by default, and an optional security sandbox for environments with multiple template authors.
v15 · externally security-audited · PHP 8.1+ · zero dependencies
UIEngine compiles its own compact template syntax (.tpl files) into cached PHP. Unlike an earlier pre-release version, the current compiler never falls back to raw text substitution: every expression runs through a recursive grammar parser that only permits a fixed, vetted set of constructs – variables, comparison operators, array/object access, but no function or method calls and no ::.
The result: template authors get a familiar, Smarty-style syntax with inheritance, includes, modifiers and custom plugins – developers keep full control over what a template can actually execute.
Every expression runs through a recursive grammar parser instead of preg_replace code generation. Function calls, "::" and method calls are categorically excluded.
{$var} output is HTML-escaped by default. Anyone who wants raw output has to request it explicitly with |raw – never the other way around.
{extends}, {block}, {parent} and {include} for reusable layouts, plus {function} for your own template macros.
Optionally restrict: allowed modifiers, visible PHP constants, extra template directories, disable {eval}, allow {fetch} only for explicitly whitelisted prefixes.
Compiled templates are cached, entire pages optionally via display($tpl,$id,$lifetime) – dynamic islands stay live via {nocache}.
Pure PHP 8.1+, its own PSR-4 autoloader for use without Composer, but works just as well with it.
A snippet from a typical page with inheritance, a condition and a loop:
{extends 'layout.tpl'}
{block content}
{if $user}
Hallo {$user->name}!
{else}
Hallo Gast!
{/if}
<ul>
{foreach $items as $item}
<li>{$item.name} – {$item.price|number_format:2}€</li>
{/foreach}
</ul>
{/block}
The expression grammar is the engine's central security measure, not a filter bolted on afterwards. Paths for {include} and config files are resolved via realpath() and checked against the allowed directory before any file is read. In v15 the engine was additionally audited externally – every finding has been fixed, see the release notes.
The first page is running in a few minutes – the quick start walks through every step.