Tusk PHP

A PHP language server, written in Go

Fast, framework‑aware PHP intelligence, in one small binary.

Completion, hover, navigation, refactoring and diagnostics that understand Laravel, Symfony, WordPress and Magento 2, from PHP 7.4 to 8.5. It's ready in under a third of a second on a 9,700‑file Laravel app, and it serves editors over LSP, CI through tusk-php check and AI agents over MCP.

0
releases since 21 March 2026
0 ms
to the first answer on 9.7k files
7.4→8.5
PHP versions, all syntax
0
native diagnostic rules
0/37
PHPStan generics features, fully
0
frameworks with dedicated support

New in 0.14.0

Branch-aware types, instanceof narrowing and new diagnostics

A variable can now hold more than one type at once, and instanceof narrows it, the way PHP sees it. Hover, completion and diagnostics all agree, typing never waits for diagnostics, and tusk-php check brings the same findings to your CI.

app/Services/Uploader.php
if ($request->boolean('remote')) {
    $disk = new S3Disk($config);
} else {
    $disk = new LocalDisk($root);
}

$diskS3Disk|LocalDisk $disk->put($path, $contents);

NewBefore 0.14.0, only the last assignment counted: LocalDisk.

$user = $request->user();

if (! $user instanceof Admin) {
    abort(403);
}

if ($user->ƒ canImpersonate()boolƒ permissions()arrayƒ getAuthIdentifier()mixed) { … }

NewAlso after assert(), in elseif, match (true), and after && or ||.

try {
    $post = Post::findOrFail($id);
} catch (ModelNotFoundException $e) {
    return response($e->ƒ getModel()?stringƒ getIds()arrayƒ setModel()staticƒ getMessage()string);
}

Newcatch (A|B $e) gives A|B, and unknown members on it are reported.

// Mailer::send(string $to, string $subject)

$mailer->send⚠ Too few arguments to send(): 1 passed, at least 2 required
argument-count-mismatch
($order->email);

NewPHP would throw an ArgumentCountError here. Extra arguments to a method aren't reported any more: PHP allows them.

if (method_exists($notification, 'toArray')) {
    return $notification->toArray✓ No warning: the call is checked first($notifiable);
}

// Also understood: property_exists(), is_callable([$x, 'name']),
// early returns and ternaries on the same receiver.

BeforeUnknown member 'toArray' on 'Notification'

$measure = strlen(...);
$bound   = $measure->bindTo(null);

$measureClosure(string $string): int('tusk'); // int

NewFirst-class callable syntax gives a Closure with the callee's signature.

  • Branch-aware variable types

    After if/else, switch, try, loops and ??=, a variable has the types of every branch. Hover shows the whole union.

  • instanceof narrows variables

    Inside the if, after a guard that returns, and in match (true). A Foo|Bar tested against Foo is Bar in the else.

  • Typed catch variables

    $e-> completes the caught class's methods, in hover and in diagnostics.

  • Too few arguments

    Reported for functions, static calls and -> calls on a known class, where PHP would throw. Named arguments, spreads and __call stay unchecked.

  • Guards silence unknown-member warnings

    method_exists(), property_exists() and is_callable() silence the unknown-member warning they protect.

  • Auto-imports aliased when a name is taken

    Completing a class whose name is taken imports it under an alias, User as UserAuth. Pick the style with autoImport.aliasStyle.

  • Other fixes
    • · $this->type::tryFrom() and new static::$builder()
    • · Functions that return by reference, &__get($name)
    • · Closure parameters that shadow an outer variable
    • · DateInterval properties, $this->$name = …
    • · $q = $q->where() keeps its type, comments after assignments are ignored
    • · A comment in a parameter list, getValues(/* … */), isn't a parameter
    • · Methods after a long multi-line argument list resolve, up to 2,000 lines
NewCommand line

Diagnostics from the command line with tusk-php check

tusk-php check indexes the project the way the server does, with your PHP version, framework and diagnosticRules, and prints what your editor would show. It exits with 1 on errors or warnings.

  • ✓A whole project, or the files, directories and globs you name
  • ✓Text as path:line:col, or --format json
  • ✓A baseline, so CI fails only on new findings, even after code moves
laravel/framework
$ tusk-php check src/Illuminate \
    --write-baseline .tusk-baseline.txt >/dev/null
1670 files, 96 findings (indexed in 4.816s, checked in 4.976s)

$ tusk-php check src/Illuminate \
    --baseline .tusk-baseline.txt
1670 files, 96 findings, 0 not in the baseline, 0 in the
baseline no longer found (indexed in 2.385s, checked in 4.836s)

$ echo $?
0

Laravel's own framework source, on an Apple M3 Max.

Release history

18 releases since March 2026

Every release since 0.1.0, newest first. Correct answers come before new features, and no change may make typing wait.

Releases per month, 2026patches included

Language support

Supported features by area

Everything marked landed is on main and ships in 0.14.0. We list the gaps too, so you know what to expect.

LandedIn progressNot yet

Coverage by area

items listed on this page

PHP 7.4 to 8.5

The version comes from your Composer platform, .tusk-php.json or your local php. Each feature is checked through the running server: completion, hover, definition and diagnostics all see it.

Diagnostics and tooling

Native diagnostics, PHPStan and Laravel Pint

Native rules run in the background as you pause typing. PHPStan and Laravel Pint run on save, from your project, and their results sit next to ours without mixing in.

Native diagnostics

Built in

18 rules with stable codes, plus syntax errors. Each one can be turned off or given its own severity in diagnosticRules.

  • ✓Checked in the background once you pause typing
  • ✓A severity per rule, from off to error
  • ✓Follows your PHP version and extensions from composer.json
  • ✓Unused code greyed out, deprecated code struck through
  • ✓Eloquent: unknown columns and relations in query builders
  • ✓Blade: only the PHP inside a view is checked
  • ✓The same findings from the command line, with tusk-php check
Diagnostics run time, 329 Laravel test files
0.12.013.7 s
0.13.0+3.4 s

PHPStan

On save

When PHPStan is installed in your project, Tusk PHP runs it on save with your own config and level, and shows what it finds in the file you're editing.

  • ✓Your phpstan.neon, your baseline, your level
  • ✓Kept apart from native rules, with its own source
  • ✓Runs on save only, never while you type
  • ✓Generics read the way PHPStan defines them, so both agree on types
  • –Not in the browser build (vscode.dev)
"tuskPhpLsp.diagnostics.phpstan.enable": true

Laravel Pint

On save

Pint checks your code style on save and reports what it would change, with your pint.json. Pint stays the formatter: we won't ship a competing one.

  • ✓Style findings as diagnostics, from Pint's dry run
  • ✓Your project's Pint binary and preset
  • ✓No built-in formatter: Pint stays the only one
  • ○Applying Pint's fixes from the editor: not yet
  • –Not in the browser build (vscode.dev)
"tuskPhpLsp.diagnostics.pint.enable": true
Test coverage

Hover shows how much of a method your tests reach, with its CRAP score, from PHPUnit's or Pest's Clover report. Reports from Docker and Sail work too.

🟡 ████░ 80% · 12/15 · CRAP 5
AI agents (MCP)

tusk-php mcp gives Claude Code, Codex and Cursor the same index as your editor: symbols, diagnostics, routes, models, coverage and your database schema.

Composer hover and unused packages

Hover a package in composer.json for its installed version and PHP compatibility. tusk-php deps unused finds packages you don't use.

WebAssembly build

A WebAssembly build powers the extension on vscode.dev, kept under about 448 MB of memory.

Performance

Benchmarks against other PHP language servers

Every server gets the same requests at the same cursor positions, over stdio, with a cold cache. Correct-answer counts are published next to the timings.

Apple M3 Max, PHP 8.5.11, measured on 9 November 2026 with Tusk PHP's 0.13.0 code, Intelephense 1.18.5, Phpactor 2026.06.23.0, php-lsp 0.25.1 and PHPantom 0.10.0. Correct answers cover completion, definition, hover, references, signature help, symbols and diagnostics. Reproduce with make bench.

Response times

Median time of correct answers on the Laravel app, after start-up.

0.2 ms
completion
0.1 ms
hover
0.1 ms
go to definition
<0.1 ms
signature help

Correct answers before and after 0.13.0

Benchmark questions answered correctly.

Symfony7 → 11 of 11
Laravel11 → 14 of 19
6 Novgained by 0.13.0still to win

Diagnostics in the background

New in 0.14.0

After an edit, diagnostics are worked out in the background once you pause for about 200 ms, so completion, hover and signature help answer straight away. Results for text you've since changed are dropped.

Completion right after a keystroke, on a 6,700-line file
0.13.0~440 ms
0.14.0<40 ms

Warnings on real projects, 0.12.0 compared with 0.13.0

Warnings reported over the same samples of each project's own source, 0.12.0 against 0.13.0. Generics removed 80 more on their own samples.

0.12.00.13.0

Install

Editor extensions, binaries and the MCP server

The extensions bundle the server and pin it by SHA-256, so there's nothing else to install. Every default is chosen to work with no configuration.

VS Code & VSCodium

Available

Local projects, Remote SSH and vscode.dev in the browser.

Zed

Registry soon

Listing in Zed's extension registry is waiting on review. Until then, install it as a dev extension.

Neovim & any LSP editor

Available

Binaries for Linux, macOS and Windows, on amd64 and arm64.

tusk-php --transport stdio

AI agents

Available

Claude Code, Codex, Cursor and any stdio MCP client get your project's symbols, diagnostics, routes, models, coverage and database schema.

claude mcp add tusk-php -- tusk-php mcp --root "$(pwd)"

Download

MIT licensed

Every release, with checksums and the WebAssembly build.

Roadmap

Milestones in progress

Each milestone has one public tracking issue. Found a wrong answer? A short PHP snippet on GitHub is the fastest way to get it fixed.

Tusk PHP 0.14.0 for VS Code, Zed, Neovim and AI agents

Free and open source under the MIT licence.