lex binary is available at vendor/bin/lex. Use it to manage templates without writing PHP.
The CLI reads your
lex.config.json file automatically. Make sure it exists at the project root before running any command.Commands
lex compile <path>
lex compile <path>
Recursively finds every Arguments
Example: CI/CD deployment pipelineRun
.lex file under <path> and compiles it to a PHP file in the cache directory. Use this before enabling production mode so all compiled files are ready before the first request.| Argument | Description |
|---|---|
<path> | Directory to scan recursively for .lex template files |
lex compile as a build step before switching the application to production mode. This ensures every template is precompiled and no source-file I/O happens at runtime.lex cache:clear <dir>
lex cache:clear <dir>
Deletes the compiled PHP files and AST snapshots from the cache directory. Forces a full recompile on the next request.Arguments
This removes all files under
| Argument | Description |
|---|---|
<dir> | Cache directory to clear (typically .lexer/) |
<dir>/compiled/ and <dir>/ast/, as well as the dependency graph at <dir>/view_dependencies.json.lex benchmark <template>
lex benchmark <template>
Renders the specified template multiple times and reports the mean render time in milliseconds. Useful for identifying slow templates before they reach production.Arguments
The command outputs a summary showing the number of iterations, mean time, minimum, and maximum render times.
| Argument | Description |
|---|---|
<template> | Dot-notation template name to benchmark (e.g. pages.home) |
lex validate <path>
lex validate <path>
Parses and validates every Arguments
Use this in CI pipelines to catch template errors before deployment, without touching the cache.
.lex file under <path> without rendering or writing any compiled output. Reports syntax errors, unmatched blocks, and unknown directives.| Argument | Description |
|---|---|
<path> | Directory to scan recursively for .lex template files |
CI/CD deployment workflow
A typical production deployment runs three steps in order:Precompile templates
Write all compiled PHP files to the cache directory so no compilation happens at runtime.