The DevTools extension is only active in development mode. Calling
$lexer->setProduction() disables LexDebugger completely — no payload is injected and there is zero overhead in production.How it works
In development mode (the default), everyrender() call passes through LexDebugger, which hooks into the runtime managers and injects a JSON payload into the HTML response just before </body>:
LexDebugger is bypassed entirely — the payload is never injected and no hooks run:
Installation
Load the Chrome extension
- Open
chrome://extensionsin Chrome. - Enable Developer mode (top-right toggle).
- Click Load unpacked.
- Select the
lexer-debug-extension/dist/directory.
Configure PHP
No extra PHP setup is required. Use
Lexer::render() as normal — LexDebugger activates automatically when production is false:DevTools panel
Open Chrome DevTools (F12) and select the Lex tab.
- Components
- Sections
- Cache
- Network
- Timeline
Displays the full component tree rendered during the request.
Props are shown with their binding type:
| Column | Description |
|---|---|
| Tree (left) | All components in render order — click any row to select it |
| Detail (right) | Component name, file path, props (name / value / type), slots, and render time |
| Highlight in Page | Scrolls to and flashes the component’s DOM element |
| Type | Example | Meaning |
|---|---|---|
literal | title="Hello" | Static string |
expression | :user="$currentUser" | PHP expression |
boolean | closable | Bare attribute → true |
Error overlay
When Lex throws aTemplateSyntaxException (or similar), the extension intercepts the error HTML and replaces it with a readable overlay:
- The overlay shows the file path, line number, column, and a source snippet with the error line highlighted.
- Open in VS Code opens the file at the exact line in your editor.
- Dismiss the overlay with
Escor the✕button. - The overlay works without
LexDebuggerby parsing raw PHP error output. WhenLexDebuggeris active, it uses richer data from theerrors[]payload field.
Hover inspector
Toggle inspect mode withAlt+Shift+X or the popup button.
- Hover over any element to see a tooltip with the component name, file path, and render time.
- Click an element to select the component in the DevTools Lex panel.
data-lex-* attributes on component root elements, which LexDebugger injects automatically in dev mode.
Disabling in production
Set"production": true in lex.config.json:
setProduction() in your bootstrap:
LexDebugger will not be instantiated, no hooks will run, and no <script id="__lex_debug__"> tag will be injected into any response.