Skip to content

Getting Started

This guide takes you from zero to a working php-lsp setup in about five minutes.

Choose the method that suits your environment.

Cargo (recommended if you have a Rust toolchain):

Terminal window
cargo install php-lsp

The 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:

Terminal window
tar xzf php-lsp-<target>.tar.gz
sudo mv php-lsp /usr/local/bin/php-lsp

On Windows, extract php-lsp.exe from the .zip and move it to a directory on your PATH.

Build from source:

Terminal window
git clone https://github.com/jorgsowa/php-lsp
cd php-lsp
cargo build --release
# binary at target/release/php-lsp
Terminal window
php-lsp --version
# php-lsp 0.28.0

If you get command not found, ensure the install directory is on your PATH:

Terminal window
# Cargo installs
export PATH="$HOME/.cargo/bin:$PATH"
# Manual installs — check with:
which php-lsp

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.

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.

  • Configuration — set phpVersion, suppress noisy diagnostics, exclude generated paths
  • Features — full list of everything php-lsp supports
  • Architecture — internals for contributors and advanced users