Editor & AI Client Setup
This page covers setup for every supported editor and AI coding client.
Finding the binary path
Section titled “Finding the binary path”The path to the php-lsp binary depends on how you installed it.
Installed via cargo install php-lsp:
~/.cargo/bin/php-lspDownloaded a pre-built binary from Releases:
Move it somewhere on your PATH, e.g.:
sudo mv php-lsp /usr/local/bin/php-lspThen the path is /usr/local/bin/php-lsp.
You can verify the path with:
which php-lspAI Coding Clients
Section titled “AI Coding Clients”Claude Code
Section titled “Claude Code”Install the official plugin:
claude plugin marketplace add https://github.com/jorgsowa/claude-php-lsp-pluginclaude plugin install php-lspThe plugin configures everything automatically. The server binary must be on your PATH (or set the full path in the plugin’s .lsp.json after installation).
To override initializationOptions, edit .lsp.json in the plugin directory:
{ "command": "/usr/local/bin/php-lsp", "initializationOptions": { "phpVersion": "8.2", "excludePaths": ["cache/*"] }}Cursor
Section titled “Cursor”Open Settings → Features → Language Servers → + and set:
| Field | Value |
|---|---|
| Command | /usr/local/bin/php-lsp |
| File pattern | *.php |
Or add to .cursor/mcp.json in your project root:
{ "languageServers": { "php-lsp": { "command": "/usr/local/bin/php-lsp", "filetypes": ["php"], "initializationOptions": { "phpVersion": "8.5" } } }}OpenCode
Section titled “OpenCode”Add to opencode.json (or opencode.jsonc) in your project root:
{ "$schema": "https://opencode.ai/config.json", "lsp": { "php-lsp": { "command": ["/usr/local/bin/php-lsp"], "extensions": [".php"], "initialization": { "phpVersion": "8.5", "excludePaths": [] } } }}Editors
Section titled “Editors”Add to ~/.config/zed/settings.json:
{ "lsp": { "php-lsp": { "binary": { "path": "/usr/local/bin/php-lsp" }, "initialization_options": { "phpVersion": "8.5", "excludePaths": [] } } }, "languages": { "PHP": { "language_servers": ["php-lsp"] } }}VS Code
Section titled “VS Code”Install the php-lsp extension (source). It ships a pre-built binary — no separate install required.
Via the Quick Open palette (Ctrl+P / Cmd+P):
ext install jorgsowa.php-lspAvailable settings (VS Code settings.json):
| Setting | Default | Description |
|---|---|---|
php-lsp.serverPath |
(auto) | Path to the php-lsp binary; leave empty for auto-detection |
php-lsp.phpVersion |
8.5 |
PHP version (7.4 – 8.6) |
php-lsp.excludePaths |
[] |
Glob patterns to exclude from the workspace |
php-lsp.diagnostics.* |
true |
Per-diagnostic toggles (undefined variables/functions/classes, arity errors, type mismatches, deprecated calls, duplicate declarations) |
Note: If Intelephense (or another PHP extension) is installed, it will conflict with php-lsp. Disable it via Extensions → Intelephense → Disable before using this extension.
Neovim 0.11+
Section titled “Neovim 0.11+”Create ~/.config/nvim/lsp/php_lsp.lua:
---@type vim.lsp.Configreturn { cmd = { '/usr/local/bin/php-lsp' }, filetypes = { 'php' }, root_markers = { 'composer.json', '.git' }, workspace_required = true, init_options = { phpVersion = '8.5', excludePaths = {}, },}Then enable it in init.lua:
vim.lsp.enable('php_lsp')Neovim 0.10 and older
Section titled “Neovim 0.10 and older”Add to init.lua:
vim.api.nvim_create_autocmd('FileType', { pattern = 'php', callback = function() vim.lsp.start({ name = 'php-lsp', cmd = { '/usr/local/bin/php-lsp' }, root_dir = vim.fs.root(0, { 'composer.json', '.git' }), init_options = { phpVersion = '8.5', excludePaths = {}, }, }) end,})PHPStorm
Section titled “PHPStorm”Install the php-lsp plugin from the JetBrains Marketplace (Settings → Plugins → Marketplace → “php-lsp”).
The plugin handles everything automatically — no manual server configuration required. Source is available at jorgsowa/php-lsp-phpstorm-plugin.
See configuration.md for all available options.
Configuration reference
Section titled “Configuration reference”See configuration.md for all available initializationOptions.