Getting Started
This guide takes you from zero to a working php-lsp setup in about five minutes.
Step 1 — Install
Section titled “Step 1 — Install”Choose the method that suits your environment.
Cargo (recommended if you have a Rust toolchain):
cargo install php-lspThe binary is placed at ~/.cargo/bin/php-lsp.
Pre-built binary (no Rust required):
Download the archive for your platform from Releases:
| File | Platform |
|---|---|
php-lsp-aarch64-apple-darwin.tar.gz |
macOS — Apple Silicon |
php-lsp-x86_64-apple-darwin.tar.gz |
macOS — Intel |
php-lsp-x86_64-unknown-linux-gnu.tar.gz |
Linux — 64-bit (glibc) |
php-lsp-aarch64-unknown-linux-gnu.tar.gz |
Linux — ARM64 (glibc) |
php-lsp-x86_64-unknown-linux-musl.tar.gz |
Linux — 64-bit (musl, e.g. Alpine) |
php-lsp-aarch64-unknown-linux-musl.tar.gz |
Linux — ARM64 (musl, e.g. Alpine) |
php-lsp-x86_64-pc-windows-msvc.zip |
Windows — 64-bit |
Each archive has a matching .sha256 checksum file.
On macOS and Linux, extract it and place the binary on your PATH:
tar xzf php-lsp-<target>.tar.gzsudo mv php-lsp /usr/local/bin/php-lspOn Windows, extract php-lsp.exe from the .zip and move it to a directory on your PATH.
Build from source:
git clone https://github.com/jorgsowa/php-lspcd php-lspcargo build --release# binary at target/release/php-lspStep 2 — Verify
Section titled “Step 2 — Verify”php-lsp --version# php-lsp 0.28.0If you get command not found, ensure the install directory is on your PATH:
# Cargo installsexport PATH="$HOME/.cargo/bin:$PATH"
# Manual installs — check with:which php-lspStep 3 — Connect your editor
Section titled “Step 3 — Connect your editor”php-lsp communicates over stdin/stdout and works with any editor that supports custom LSP servers. Follow the guide for your editor:
The key setting in every editor is the command: set it to the full path returned by which php-lsp (e.g. /usr/local/bin/php-lsp or ~/.cargo/bin/php-lsp), and associate it with the php file type.
Step 4 — Open a PHP project
Section titled “Step 4 — Open a PHP project”Open a folder that contains a composer.json. php-lsp detects the workspace root from composer.json or .git, builds a PSR-4 index in the background, and starts serving completions, diagnostics, and navigation immediately.
You will see a $/progress spinner in your editor’s status bar while the initial index is being built. Features work before indexing completes — the index just improves cross-file results.
Next steps
Section titled “Next steps”- Configuration — set
phpVersion, suppress noisy diagnostics, exclude generated paths - Features — full list of everything php-lsp supports
- Architecture — internals for contributors and advanced users