A language server for PHP 8.1 through 8.6, written in Rust, that speaks LSP over stdio. It indexes a project with its Composer packages and the standard library, and answers completion, hover, navigation, usages, rename, inspections with fixes, refactors, formatting, semantic tokens, inlay hints and the tests a file can run, with support for PHPUnit, Pest, Laravel and Symfony. The SQL in its strings is read as SQL, with diagnostics, completion against a schema and the rest. It reads code and never runs it.
Every release attaches an archive for macOS on Apple silicon, Linux arm64 and x64, and Windows arm64 and x64, with a checksum each and a descriptor an installer pins. Or build it yourself with Rust 1.85 or newer:
cargo build --release --lockedThe binary lands in target/release/php-language-server. PHP itself is not needed, to build or to run.
php-language-server --stdio| Page | What it covers |
|---|---|
| Getting started | Building, starting and connecting |
| Configuration | Settings, language level, Composer, stubs, cache and formatter |
| Features | What it answers, frameworks and runnable tests |
| SQL in strings | Which strings are SQL, how to mark one, dialects and schemas |
| Clients | What an editor sends and announces for each feature |
| Distribution | Release archives and the descriptor an installer pins |
| Maintaining | The crates, checks, corpus and releases |
NATIVE.md describes how the implementation works and what is left to do, and MEASUREMENTS.md what it was measured to do.
- PHP 8.6 is the default language level. Set a project's level in Composer or with the
phpVersionsetting. - Frameworks and packages are modeled where they give strings and members meaning: Laravel, Eloquent, Livewire, Inertia, Pennant, Filament, Symfony, Doctrine, API Platform's serialization groups, Messenger, Workflow and the Raxos ORM. Other packages get what their declarations and PHPDoc say.
- Usages are found in the project, and in installed packages when
usages.packagesasks for them, across PHP, Blade, Twig and the YAML of a Symfony project. Strings count when a framework gives them meaning or when they hold a qualified class name; other strings and ordinary comments do not. - Nothing is run: dynamic code, such as variable variables and members made at run time, gives
mixed, and a name built at run time is never reported as missing.
Functional Source License, Version 1.1, MIT Future License. The phpstorm-stubs and php-src corpora are downloaded separately and keep their own licenses; see THIRD-PARTY.md.