Zandy PHP Template Engine
The compiled PHP template engine with zero learning cost.
Native PHP variables. Pure HTML superset. One file.
Why Zandy PHP Template Engine
Zero Learning Cost
Expressions are pass-through PHP — {$user->getName()} just works. No new expression language to learn, ever.
Pure HTML Superset
Logic lives in HTML comments (<!--{if $a}-->), output in braces. Open an uncompiled template in a browser — it just renders.
Line-Level Diagnostics
Nesting errors are caught at compile time with template line numbers — not as PHP fatals in generated code.
PHP 5.6 – 8.6, One Codebase
Legacy LTS to bleeding edge: a single file runs everywhere. No version forks, no polyfill packages.
Engineering Built In
Concurrent compile lock, deploy-time precompile CLI, executable syntax spec (DocAsTest), sandbox policy object.
AI-Ready
llms.txt, llms-full.txt, and a distributable AI-assistant skill — your AI pair-programmer writes correct ZPTE templates on day one.
Thirty-Second Tour
template.htm — valid HTML, preview it directly
<h1>{$siteName}</h1>
<!--{if $user is not empty}-->
<p>Welcome back, {$user.name|escape}!</p>
<!--{else}-->
<p>Please sign in.</p>
<!--{/if}-->
<!--{loop $items as $item}-->
<li>{$item.title} — {$item.price|number_format:2}</li>
<!--{loop-else}-->
<li>No items yet.</li>
<!--{/loop}-->
Rendered output (static snapshot)
Acme Shop
Welcome back, Ada!
- Mechanical keyboard — 129.00
- USB-C hub — 39.50
render.php — that is all the PHP you need
require_once 'Template.php';
$GLOBALS['siteConf'] = [
'tplBaseDir' => '/app/templates',
'tplCacheBaseDir' => '/app/cache',
'tplDir' => '/app/templates',
];
echo Zandy_Template::outString('template.htm');
Everything Included
Template Inheritance
extends / block / parent — plus macros and fragment caching as first-class plugins.
22 Built-in Filters
upper, truncate, json, slice, number_format… chainable, UTF-8 safe, no mbstring required.
i18n Pluralization
trans with zero/one/other branches and named placeholders like {name}.
Sandbox Policy
Four-level whitelists (functions / methods / properties / static) enforced at compile time.
On-Demand Plugins
pagination, asset versioning, text, number, nav, seo — require what you need, nothing more.
VSCode Extension
Syntax highlighting and snippets; the same TextMate grammar imports into JetBrains IDEs.