Blade Intelephense Bridge
Full PHP Intelephense intelligence inside .blade.php files — the same completions, diagnostics, and navigation you get in plain .php, now in your Blade templates.
Blade files are registered under the blade language, which Intelephense ignores (its language server only attaches to php). This extension bridges that gap: it spawns a private Intelephense language server as a child process and feeds it a PHP projection of each Blade file over the LSP protocol — so completions, hover, go-to-definition, signature help, and diagnostics all work inside .blade.php exactly as they do in plain .php files.
Screenshots
Import an unimported class — auto-inserts the use statement
Add a method call — snippet with tab stops for each argument
Tailwind class completions inside a PHP string
Tailwind class completions inside a JS string
Who is this for?
This extension adds PHP class intelligence inside Blade templates — for any project that uses Blade, including Laravel.
If Intelephense is your PHP engine, it ignores .blade.php files by default (the language ID is blade, not php). This bridge fills that gap: it spawns a private Intelephense instance and routes completions, hover, go-to-definition, and PHP diagnostics into your Blade files.
It is complementary to dedicated Laravel tools — the official Laravel extension and Laravel Blade Snippets handle Blade directive snippets, route/view/config completions, and facades. This bridge handles raw PHP class and method intelligence inside the PHP regions of your templates.
It does not provide Blade directive completions (@if, @foreach, @component etc.) or Laravel-specific completions — those belong to the tools above.
Features
- Class & method completion —
Str::, $model->, your project classes, vendor classes, PHP built-ins. Works in both <?php ?> tags and @php ... @endphp directive blocks.
- Method-call snippets — accepting a method inserts its full call with editable argument placeholders:
Str::find($find, $str, $caseSensitive), Tab through each.
- Unimported-class completion + auto-import — type a class name (e.g.
Str) and pick from every matching class in your workspace, shown with its fully-qualified name. Accepting inserts the use Spectabile\Foundation\Str; statement automatically, matching your file's existing indentation.
- Hover documentation — full type info and PHPDoc on hover.
- Go to definition — jump straight to the class, method, or function source.
- Signature help — parameter hints as you type call arguments.
- PHP diagnostics — real Intelephense errors and warnings, relayed onto the exact lines of your Blade file.
- Import Class command — right-click a class name → Blade: Import Class. If several classes share the name, pick which one to import.
- Tailwind class completions in PHP & JS strings — if you use Tailwind CSS IntelliSense and add a one-line
classRegex entry to your settings.json (see Settings), Tailwind completions fire inside any string literal in .blade.php, .php, and .js files — not just inside HTML class="..." attributes. Works for $var = 'flex items-center', ternary branches, and JS property assignments alike.
PHP intelligence comes from a private Intelephense instance that the bridge spawns at activation time — it indexes the same workspace folders and honours the same licence key as your main Intelephense installation. Tailwind completions continue to come from your existing Tailwind CSS IntelliSense instance.
Requirements
- PHP Intelephense (
bmewburn.vscode-intelephense-client) must be installed and active. This extension is a bridge to it, not a replacement.
- A Blade language grammar that registers
.blade.php under the blade language id (for example Laravel Blade Snippets — only its grammar is needed; its Laravel snippets are independent of this bridge).
- Tailwind CSS IntelliSense (
bradlc.vscode-tailwindcss) — optional. Required only for Tailwind class completions inside PHP and JS string literals. See Settings for the one-line entry to add to your settings.json.
Settings
Extension settings
| Setting |
Type |
Default |
Description |
bladeBridge.debug |
boolean |
false |
Write debug output to the Blade Bridge output channel. Enable when troubleshooting. |
bladeBridge.diagnostics.enabled |
boolean |
true |
Report PHP errors and warnings in Blade files. Disable if you only want completions without error underlining. |
Intelephense settings that affect the bridge
The bridge runs its own private Intelephense process, so most of your main Intelephense settings do not carry over. The ones that do:
| Intelephense setting |
Effect on the bridge |
intelephense.licenceKey |
The bridge reads this key and passes it to its private server, so premium features (full workspace index) work without a separate licence entry. |
intelephense.diagnostics.run |
When to surface PHP errors in Blade files. "onType" shows them live; "onSave" shows them after saving (the bridge syncs the virtual document on every keystroke either way). |
intelephense.files.exclude |
Folders the private server will not index. Keep your project source out of this list so classes resolve in Blade files. |
tailwindCSS.experimental.classRegex
Tailwind completions come from the Tailwind CSS IntelliSense extension (bradlc.vscode-tailwindcss), not from this bridge. If you want those completions to fire inside PHP or JS string literals — not just inside HTML class="..." attributes — add this to your settings.json:
"tailwindCSS.experimental.classRegex": [
["[\"'`](https://github.com/spectabile/blade-intelephense-bridge/blob/HEAD/[^\"'`\\n]+)[\"'`]", "([^\"'`\\n]+)"]
]
Without this entry, Tailwind IntelliSense only completes inside HTML attributes and is silent in blade/PHP/JS string contexts. With it, completions work for $var = 'flex items-center', ternary branches, and JS property assignments alike.
For Tailwind completions to appear automatically inside JS strings (without pressing Ctrl+Space), ensure "other" is enabled in your [javascript] quick suggestions:
"[javascript]": {
"editor.quickSuggestions": {
"strings": true,
"other": "on"
}
}
If .blade.php files open as plain php (or html) instead of blade, ensure your Blade grammar's file association is active:
"files.associations": {
"*.blade.php": "blade"
}
How it works
For each open Blade file the extension maintains a virtual PHP document — a projection of the template's PHP regions with non-PHP areas blanked out so line and column positions stay identical to the original Blade file. No position translation is ever needed.
No files are written to disk. Virtual documents exist only in the private Intelephense server's in-memory document store — they are never written to the filesystem, never appear as editor tabs, and never touch your repository.
At activation the extension locates the Intelephense JS server binary that ships inside the bmewburn.vscode-intelephense-client extension and spawns it as a child process. The two processes communicate over JSON-RPC/LSP on stdio with Content-Length-framed messages — exactly as VS Code would, but without any editor UI involvement.
When a Blade file opens, its PHP projection is sent to the private server via textDocument/didOpen. On every edit, the full updated projection is sent via textDocument/didChange. On close, textDocument/didClose is sent and the record is discarded.
All LSP providers (completions, hover, definition, signature help) look up the virtual URI for the current Blade file, delegate the request to the private server at the same cursor position, and return results verbatim — position remapping is unnecessary because the projection preserves layout exactly.
Diagnostics arrive as textDocument/publishDiagnostics push notifications from the private server. They are remapped to the real Blade file URI and placed into VS Code's diagnostic collection. The P1008 / undefinedVariables diagnostic is suppressed globally — variables passed in by the controller are never assigned in the template file itself, so Intelephense flags them as undefined and cannot tell them apart from variables declared locally in the template.
Commands
| Command |
Description |
| Blade: Import Class |
Resolve the class under the cursor from the workspace index and insert its use statement. Prompts when the name is ambiguous. |
| Blade Bridge: Diagnose |
Show bridge status (mirror path, language id, completion counts) for troubleshooting. |
Notes
- Virtual PHP documents live only in the private Intelephense server's memory — no files are written to disk, nothing touches version control.
- Diagnostics honour your
intelephense.diagnostics.run setting; the virtual document is updated on every edit so errors surface even under "onSave".
- Cross-platform: the extension works on Windows, macOS, and Linux.
- Multi-root workspaces are supported — each Blade file gets its own virtual document, keyed by its full path.
Contributing
No issue tracker. GitHub Issues and Discussions are disabled. This extension is free and open source, but it is a personal tool — developed with the help of AI and shared as-is. It is not community-maintained and there is no support channel. Pull requests with code fixes or improvements are welcome.
Developed in collaboration with Claude Code (Anthropic).