#. Lex compiles them to plain PHP at build time — there is no runtime interpreter overhead.
To output a literal
# character without triggering a directive, prefix it with a backslash: \#. Only \# followed immediately by a letter is treated as an escape. See Echo & comments for details.Conditionals
#if / #elseif / #else / #endif
Use#if to conditionally render a block. You can chain as many #elseif branches as you need, and add a final #else fallback.
#unless / #endunless
#unless renders its block when the condition is falsy. It is the inverse of #if and reads more naturally in some situations.
Existence checks
#isset / #endisset
Renders its block only when the variable is set and notnull — equivalent to PHP’s isset().
#empty / #endempty
Renders its block only when the variable is empty — equivalent to PHP’sempty().
Switch
Use#switch / #case / #default / #endswitch for multi-branch matching. The expression inside #case can be any PHP value: a string literal, a variable, a class constant, etc.
#break between #case blocks enables fall-through, identical to PHP’s switch behaviour.
Raw PHP blocks
Use#php / #endphp to embed arbitrary PHP logic directly in a template. This is useful in standalone PHP projects that need inline calculations or variable preparation.
Debug helpers
Two directives are available for inspecting values during development:| Directive | Behaviour |
|---|---|
#dump($var) | Calls var_dump() and continues rendering |
#dd($var) | Calls var_dump() then halts execution with exit(1) |