php-lsp-0.1.0 is not a library.
php-lsp
A PHP Language Server Protocol (LSP) implementation written in Rust.
Features
- Diagnostics — syntax errors reported in real time as you type
- Completion — keywords, functions, classes, interfaces, traits, methods, properties, constants, and cross-file symbols from all open documents
- Hover — signatures for functions, classes (with
extends/implements), interfaces, and traits - Go-to-definition — jump to where a symbol is declared, including across open files
- Document symbols — outline of all functions, classes, methods, properties, and constants in the file
Installation
Or build from source:
# binary at target/release/php-lsp
Editor Setup
PHPStorm (2023.2+)
- Open Settings → Languages & Frameworks → Language Servers
- Click + and configure:
- Name:
php-lsp - Language:
PHP - Command:
/path/to/php-lsp
- Name:
- Set file pattern to
*.php
Neovim (via nvim-lspconfig)
vim..
VS Code
Use the custom LSP client extension or any extension that supports arbitrary LSP servers. Set the server command to the php-lsp binary.
How It Works
The server communicates over stdin/stdout using the Language Server Protocol. It uses php-parser-rs to parse PHP source into an AST, which is cached per document and reused across all requests.
License
MIT