.lex templates through a full AST pipeline — Lexer → Parser → Validator → Optimizer → PHP file. It works with any PHP project and requires no framework.
Installation
Install via Composer and get up and running in minutes
Quick Start
Render your first template with the fluent API or config file
Template Syntax
Learn the full
.lex syntax: echo, directives, loops, and includesComponents
Build reusable UI with PascalCase component tags and named slots
Layout Inheritance
Compose pages from layouts with sections, yields, and stacks
Sandbox Mode
Safely render user-submitted templates with expression whitelisting
How it works
Key features
AST compilation pipeline
Templates are compiled once through a full parse tree — never evaluated with regex at runtime.
Dependency graph cache
When a shared partial or layout changes, every template that imports it is automatically recompiled.
Custom directives
Register any PHP callable as a template directive, resolved at compile time.
CLI tooling
Precompile templates, clear caches, run benchmarks, and validate syntax from the command line.