A fast, memory-lean PHP language server written in Rust.
phrost understands real-world PHP — generics and templates, conditional return types, array shapes,
narrowing through guards and assertions — and reports what it finds with PHPStan-style strictness,
while keeping resident memory proportional to your code rather than to vendor/.
Status: pre-1.0. Used daily on a large production Drupal codebase; the numbers below are measured, and every one of them can be re-taken with the tools in this repository.
Measured on a production Drupal 10 checkout of ~31 000 PHP files (about 1 700 of them the project's
own), against the two servers people most often compare it with — see
docs/comparison.md for the method and the raw tables:
| phrost | phpantom 0.11 | intelephense 1.18 | |
|---|---|---|---|
| Memory after opening 20–40 files | ~240–310 MB | ~1 000 MB | ~1 200 MB |
| Processor time for a whole session (cold) | 13 s | 218 s | — |
| Ready from a cold start | 2.3 s | 2.0 s | — |
| hover p95 | 0.2 ms | 2.6 ms | 5.7 ms |
On the third-party php-typing-conformance suite
— 249 cases, sixteen other PHP engines — phrost passes 98.0 %, ahead of PHPStan (93.6 %),
phpantom (93.2 %), Mago (87.1 %), Psalm (81.5 %) and intelephense (76.7 %). Re-run it with
python3 tools/typing-conformance.py <clone of the suite>.
- Navigation: go to definition, declaration, type definition and implementation; find references; document highlight; call and type hierarchy; document and workspace symbols.
- Editing: completion (members, names, array keys, docblock tags) with commit characters;
signature help; hover with rendered docblocks; inlay hints; rename, including moving a file and
the namespace it declares; code actions (imports, docblock updates, quick fixes,
source.fixAll). - Presentation: semantic tokens, folding ranges, selection ranges, formatting (PER-CS by default, plus PSR-12, Laravel Pint, Tempest, hackfmt and Drupal styles).
- Diagnostics as you type, and project-wide in the background: undefined classes, functions and
members; argument, return and property type mismatches; strict null- and
false-safety (?Twhere aTis wanted is reported, on purpose); unhandledmatchcases; missing@throws; unused variables, imports and declarations; plus mago's linter for style, safety and correctness rules. - Type system:
@templatewith bounds and defaults,@extends/@implements/@use, conditional@returntypes,class-string<T>, array shapes and lists,@phpstan-typealiases,@mixin,@phpstan-assert*,@param-closure-this, and$thisinside traits read as the classes that use them.
Framework knowledge lives behind a contributor seam; no generic code names a framework.
- Drupal — first-class: the service container, entity types and their fields, routes, hooks,
form element keys, plugin annotations and attributes,
*.info.ymlnamespaces, and the docroot/corelayout composer installs outsidevendor/. - Laravel — Blade templates read as the PHP their expressions are (goto, hover and completion
inside
{{ }}and directives; variables typed by theview()call,@includeor<x-...>tag that renders the template, or by{{-- @var --}}; a Livewire component's template sees the component as$thisand its public properties as variables; the checks run over the expressions too), Eloquent relations read as the properties they load ($post->commentsis aCollection<int, Comment>,$post->authora?User, including relations written with a bareBelongsTohint), accessors in both spellings (getExcerptAttribute()andexcerpt(): Attributeread as$post->excerpt, typed by the getter closure the body hands over), attributes from$casts,casts(),$fillableand#[Fillable], and theidkey (a cast is nullable: whether a column can be null is in the database), local scopes (scopePublished()and#[Scope]) called, completed and navigated aspublished()on the model and on its builder,Model::where(...)forwarded to the query builder, dynamic wheres (User::whereEmail($email)->first(), offered per stated column),auth()->user()and$request->user()(the modelconfig/auth.phpnames, nullable), the container's aliases throughapp('router'),resolve('cache')and$app['config'], the facades' global aliases (use DB;),trans()and__()as a string or an array by what the language files say the key holds, contracts read as the classes bound to them (Cache::store()->lock(),Storage::disk()->url()), and model factories that make one model unless the chain counted (User::factory()->create()). - Laravel, Symfony — otherwise understood through their own PHPDoc and generics (collections,
builders, the container's
@templatesignatures), with generated directories (bootstrap/cache,storage/framework,var/cache) kept out of the index. - PHPUnit, Mockery, Pest — test-runner control flow and mock objects are read the way those
libraries behave at runtime, and a Pest test's
$thisis the test case its suite configures withuses()orpest()->extend().
Prebuilt binaries for Linux (x86_64, aarch64) and macOS (Apple silicon, Intel) are attached to
every GitHub release. Each archive holds the
phrost binary with its licenses; put the binary somewhere on your PATH:
tar xzf phrost-aarch64-apple-darwin.tar.gz
install phrost-aarch64-apple-darwin/phrost ~/.local/bin/
phrost --versionFrom source, with a Rust toolchain (the exact version is pinned in rust-toolchain.toml, and
rustup picks it up automatically):
git clone https://github.com/koroblabs/phrost
cd phrost
cargo build --release -p phrost-cli
# put target/release/phrost somewhere on your PATHphrost speaks the Language Server Protocol over stdio: phrost serve.
Zed has no phrost extension yet, but its PHP extension's language server can be pointed at
phrost: Zed launches the binary a setting names instead of the one the extension would install. In
your settings.json:
{
"languages": {
"PHP": {
"language_servers": ["phpactor", "!intelephense", "!phptools", "!phpantom", "..."]
}
},
"lsp": {
"phpactor": {
"binary": {
"path": "/absolute/path/to/phrost",
"arguments": ["serve"]
}
}
}
}The path has to be absolute (which phrost prints it). This attaches phrost to PHP files only: Twig
and Blade templates and Drupal's YAML files need an extension that registers the server for them
too.
Neovim (0.11+):
vim.lsp.config('phrost', {
cmd = { 'phrost', 'serve' },
filetypes = { 'php' },
root_markers = { 'composer.json', '.git' },
})
vim.lsp.enable('phrost')Helix (languages.toml):
[language-server.phrost]
command = "phrost"
args = ["serve"]
[[language]]
name = "php"
language-servers = ["phrost"]Claude Code: a plugin is included in editors/claude-code.
Any other editor that can launch a stdio language server works the same way.
Everything is optional. A phrost.toml at the project root:
# Switch a framework on that detection did not find.
framework = ["drupal"]
[files]
# Not this project's code, on top of what is skipped already.
exclude = ["docroot/sites/legacy", "tools/fixtures"]
# Code, whatever the ignore files say.
include = ["docroot/core/lib"]
[lint]
# Linter categories reported without being named.
categories = ["correctness", "safety"]
# Opt-in checks to switch on, and any code -- linter or type check -- to switch off.
on = ["doc-missing-tags", "unused-declaration"]
off = ["doc-undefined-type"]
[diagnostics]
# Check only open files rather than the whole project in the background.
project = falseThe same settings can come from the client's initializationOptions.
phrost serve # the language server, over stdio
phrost check <project> [--ratchet] # every diagnostic over a project, as CI would
phrost index <project> [--warm] [--memory] # what gets indexed, and what it costs
phrost coverage <project> # how much of the project's code resolves
phrost query <project> <file> <line> <col> # what an editor would show at a position
phrost perf <project> # request latency against the budgetsphrost check --ratchet compares a run against a phrost-baseline.toml beside the project and
fails on any code whose count rose, which makes it usable in CI on a codebase that is not clean yet.
just test # the whole suite (cargo test --workspace works too)
just lint # rustfmt, prettier for the Markdown, clippy -D warnings
just fmt # format the Rust and the Markdown
just pr-ready # everything CI checks
just deny # licenses, bans, sources and advisoriesjust, cargo-nextest and cargo-deny are assumed:
cargo install just cargo-nextest cargo-deny --locked. Prettier runs through npx, so formatting
the Markdown needs Node.
The design is documented in docs/: the crate graph and its enforced boundaries,
the eleven test levels, the roadmap, and a record of the bugs already paid for. Performance budgets
live in crates/cli/src/perf/budget.rs and are checked by phrost perf.
Copyright (c) 2026 Korob Labs opensource@koroblabs.com.
Licensed under either of Apache License, Version 2.0 or MIT license
at your option. The bundled PHP standard-library stubs are vendored from
mago's prelude under the same terms — see
third_party/php-prelude/README.md and NOTICE.
Every release archive carries the licenses of the crates compiled into it, in
THIRD-PARTY-LICENSES.md.