This article is initial research on v0.0.19, as of June 2026. Because it isn’t registered on Packagist yet, you can’t install it via Composer.
What is Laravel LSP?
Laravel LSP (Language Server Protocol) is Laravel’s official tool that brings framework-aware IDE features to your editor. The Language Server Protocol is a standard protocol for communication between an LSP client (your editor) and an LSP server (Laravel LSP), enabling a unified development experience across multiple editors.
Features provided by Laravel LSP:
- Completion — Auto-complete routes, views, config keys, translation keys, Livewire components, and more
- Hover info — Show descriptions, documentation, and context info when hovering
- Diagnostics — Detect issues in your code in real time
- Document links — Link between files and resources
- Quick fixes — Auto-fix suggestions for common issues
- Go to definition — Jump to a symbol’s definition
Why you need it
The editor’s built-in PHP completion doesn’t understand the Laravel framework’s abstraction layers. For example:
- No completion for the URI pattern as the first argument of
Route::get()
- Entering a view name in
view('users.index') doesn’t complete against actual view files
- Config keys (
config('app.name')) and translation keys (trans('messages.welcome')) aren’t included in completion
- Completion and validation inside Blade templates aren’t supported by default
Laravel LSP understands these “framework-specific contexts” and provides accurate completion and diagnostics.
Installation
Global installation
Install globally with Composer:
composer global require laravel/lsp
Make sure Composer’s global bin directory is on your PATH. You can then start it with:
Installation from source
To use the development version, clone the repository and run it:
gh repo clone laravel/lsp
cd lsp
composer install
php server
Set up a shell alias so you can use the laravel-lsp command:
# For Zsh
echo 'alias laravel-lsp="php /path/to/lsp/server"' >> ~/.zshrc
source ~/.zshrc
# For Bash
echo 'alias laravel-lsp="php /path/to/lsp/server"' >> ~/.bashrc
source ~/.bashrc
Editor configuration guides
Because Laravel LSP uses the standard LSP protocol, it works with any editor that supports LSP. Here are configurations for major editors.
Sublime Text
Install the LSP package, then add a client config via Preferences: LSP Settings:
{
"clients": {
"laravel-lsp": {
"enabled": true,
"command": ["laravel-lsp"],
"selector": "embedding.php | text.html.blade"
}
}
}
Neovim
On Neovim 0.11+, you can add a custom LSP configuration directly:
vim.lsp.config("laravel_lsp", {
cmd = { "laravel-lsp" },
filetypes = { "php", "blade" },
root_markers = { "artisan", "composer.json", ".git" },
})
vim.lsp.enable("laravel_lsp")
If you use nvim-lspconfig, register it like this:
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
if not configs.laravel_lsp then
configs.laravel_lsp = {
default_config = {
cmd = { "laravel-lsp" },
filetypes = { "php", "blade" },
root_dir = lspconfig.util.root_pattern("artisan", "composer.json", ".git"),
},
}
end
lspconfig.laravel_lsp.setup({})
Cursor
Cursor supports VS Code extensions, so if the Laravel extension is installed it’s automatically supported. For local development, use a VS Code-compatible LSP client and specify the command:
VS Code
VS Code likewise has LSP client capabilities and can be configured through extensions.
OpenCode
Enable LSP support in opencode.json and configure Laravel LSP as a custom server:
{
"$schema": "https://opencode.ai/config.json",
"lsp": {
"laravel-lsp": {
"command": ["laravel-lsp"],
"extensions": [".php", ".blade.php"]
}
}
}
Configuring with the GitHub Copilot CLI
When using the GitHub Copilot CLI, you can configure it globally in ~/.copilot/lsp-config.json. No separate editor configuration is required:
{
"lspServers": {
"laravel-lsp": {
"command": "laravel-lsp",
"fileExtensions": {
".php": "php",
".blade.php": "blade"
}
}
}
}
Copilot CLI’s LSP server configuration also supports initializationOptions, so you can use all the detailed settings described below.
Configuration options
LSP clients can pass detailed configuration to Laravel LSP through initializationOptions.
PHP environment detection
The phpEnvironment option controls the PHP command used to index project data. The default is auto, which auto-detects:
| Value | PHP command behavior |
|---|
auto | Try Herd → Valet → Sail → Lando → DDEV → local PHP in order |
herd | Uses herd which-php |
valet | Uses valet which-php |
sail | Uses ./vendor/bin/sail php while Sail is running |
lando | Uses lando php |
ddev | Uses ddev php |
local | Uses the local PHP binary directly |
If detection fails or an invalid value is passed, it falls back to php.
Basic configuration example
{
"phpEnvironment": "auto",
"phpCommand": ["php"],
"definitionProvider": false
}
Per-feature configuration
Each feature can be individually enabled or disabled. Suffixes include Completion, Diagnostics, Hover, Link, and so on:
{
"routeCompletion": true,
"routeDiagnostics": true,
"viewDiagnostics": false,
"translationHover": true,
"configLink": true,
"envCompletion": true,
"bladeComponentLink": true
}
Provided features overview
| Feature area | Completion | Hover | Diagnostics | Link | Quick fixes |
|---|
| Routes | ✓ | ✓ | ✓ | ✓ | - |
| Views & Blade | ✓ | ✓ | ✓ | ✓ | ✓ |
| Translation | ✓ | ✓ | - | - | - |
| Config | ✓ | ✓ | ✓ | ✓ | - |
| Env variables | ✓ | ✓ | ✓ | ✓ | ✓ |
| Assets & Mix | ✓ | ✓ | ✓ | ✓ | - |
| Middleware | ✓ | ✓ | ✓ | ✓ | - |
| Inertia | ✓ | - | ✓ | ✓ | - |
| Livewire | ✓ | ✓ | - | ✓ | - |
| Auth & Policies | ✓ | ✓ | ✓ | ✓ | - |
| Container Bindings | ✓ | ✓ | ✓ | ✓ | - |
| Validation | ✓ | - | - | - | - |
| Controller Actions | ✓ | - | ✓ | ✓ | - |
| Eloquent | ✓ | - | - | - | - |
Quick start
- Install —
composer global require laravel/lsp
- Configure your editor — see the per-editor guides above
- Open a Laravel project — the server indexes project data from the root: routes, views, translations, config, etc.
- Use completion — framework-aware completion works automatically inside PHP files and Blade templates
Summary
Laravel LSP significantly improves the developer experience. It understands framework-specific context that the editor’s default features can’t, and delivers more accurate and useful completion and diagnostics.
Requirements:
- PHP 8.2 or later
- Composer
- An LSP-capable editor (Sublime Text, Neovim, Cursor, VS Code, etc.)
References: