PHPackages                             clearlyip/mago-lsp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. clearlyip/mago-lsp

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

clearlyip/mago-lsp
==================

Installs the Mago language-server binary (built with --features language-server) into vendor/bin/mago-lsp.

1.30.1(1mo ago)2406↓44.4%1[6 PRs](https://github.com/clearlyip/mago-vscode-extension/pulls)1MITTypeScriptPHP &gt;=8.1CI failing

Since May 26Pushed 3w agoCompare

[ Source](https://github.com/clearlyip/mago-vscode-extension)[ Packagist](https://packagist.org/packages/clearlyip/mago-lsp)[ Docs](https://github.com/clearlyip/mago-vscode-extension)[ RSS](/packages/clearlyip-mago-lsp/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (20)Used By (1)

 [![Mago Banner](https://raw.githubusercontent.com/clearlyip/mago-vscode-extension/refs/heads/master/docs/static/img/banner.png)](https://raw.githubusercontent.com/clearlyip/mago-vscode-extension/refs/heads/master/docs/static/img/banner.png)

Mago LSP
========

[](#mago-lsp)

[![VS Code Marketplace](https://camo.githubusercontent.com/73bf6ae3d8c443ce5838be1cf1c92994c3fc60768ca9f14ef50b11f6c0fa988f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f56535f436f64655f4d61726b6574706c6163652d4d61676f5f4c53502d626c75653f7374796c653d666c61742d737175617265266c6f676f3d76697375616c73747564696f636f6465)](https://marketplace.visualstudio.com/items?itemName=Clearlyip.mago-vscode-extension)[![VS Code Version](https://camo.githubusercontent.com/6ed3a1646973fb9e5f0af6c5f59e06271135d93926b2370448f19e02118483db/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f56535f436f64652d253345253344312e39352e302d626c75653f7374796c653d666c61742d737175617265266c6f676f3d76697375616c73747564696f636f6465)](https://code.visualstudio.com)[![TypeScript](https://camo.githubusercontent.com/a55b6e2e64c0ab055ff5a512f7385645942109901ccc86a7e3731601250eec7b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f547970655363726970742d626c75653f7374796c653d666c61742d737175617265266c6f676f3d74797065736372697074266c6f676f436f6c6f723d7768697465)](https://www.typescriptlang.org)[![License MIT](https://camo.githubusercontent.com/f3cd9467f1a2673efb050d325944267a717320385a6e45da3a19f994f9004339/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f773f7374796c653d666c61742d737175617265)](LICENSE)

VS Code extension for PHP linting, formatting, and static analysis powered by the [Mago](https://github.com/carthage-software/mago) language server.

[Prerequisites](#prerequisites) • [Installation](#installation) • [Configuration](#configuration) • [Commands](#commands) • [Troubleshooting](#troubleshooting)

Overview
--------

[](#overview)

**Mago LSP** integrates [Mago](https://mago.carthage.software) — a high-performance PHP linter, formatter, and static analyzer written in Rust — into Visual Studio Code via the Language Server Protocol. It provides real-time diagnostics, code formatting, hover information, completion, inlay hints, and code lenses for PHP files.

Why This Extension
------------------

[](#why-this-extension)

Several unofficial Mago extensions exist on the VS Code Marketplace. This extension is different because it communicates with Mago via the **official Language Server Protocol** rather than spawning the Mago CLI binary on every operation.

This Extension (LSP)Unofficial Extensions (CLI)**Server model**Persistent language server processSpawns `mago` binary per file save / command**Startup cost**One-time on activationEvery save, every command**Real-time diagnostics**Incremental, as-you-typeOn save (or manual trigger)**LSP features**Hover, completion, inlay hints, code lensesDiagnostics only**Analysis state**Persistent across editsFresh process, no state reuseMany other extensions work by invoking the Mago CLI for each lint, analyze, or format operation. This means the binary must start up, parse the file, and shut down repeatedly. The LSP approach keeps a single server process running that maintains analysis state and responds incrementally to edits, resulting in lower latency and richer editor integration.

Prerequisites
-------------

[](#prerequisites)

The language server is an **unstable preview** in Mago and is **not included in default builds**.

Warning

The Mago language server is a work in progress. The set of advertised capabilities, the wire behaviour, the flags, and even the existence of this subcommand can change or disappear without notice. There are no compatibility guarantees until mago 2.0. If you need a stable editor integration, wait for that release.

### Option A — Composer package (recommended)

[](#option-a--composer-package-recommended)

```
composer require --dev clearlyip/mago-lsp
```

This installs a pre-built `mago` binary with LSP support into `vendor/bin/mago-lsp`. The extension detects it automatically.

### Option B — Pre-built binaries

[](#option-b--pre-built-binaries)

This repository builds LSP-enabled binaries for every new upstream Mago release. Download the appropriate archive from the [releases page](https://github.com/clearlyip/mago-vscode-extension/releases), extract the `mago` binary, and set `mago.executablePath` to its location.

### Option C — Build from source

[](#option-c--build-from-source)

```
cargo install mago --features language-server
```

Installation
------------

[](#installation)

Install from the VS Code Marketplace, or from a local `.vsix` file:

```
code --install-extension mago-0.1.0.vsix
```

Configuration
-------------

[](#configuration)

All settings are under the `mago` namespace in VS Code settings.

SettingDefaultScopeDescription`mago.executablePath``"mago"`machinePath to the Mago binary. Accepts an absolute path, a workspace-relative path (e.g. `./bin/mago`), or a name on `PATH`. When left at default, the extension first checks for `vendor/bin/mago-lsp` (Composer), then falls back to `mago` on `PATH`.`mago.configPath``""`resourcePath to `mago.toml`. If empty, Mago searches the workspace root.`mago.workspace``""`resourcePath to the workspace directory passed to the language server. Overrides the VS Code workspace root.`mago.phpVersion``""`resourcePHP version for parsing and analysis, e.g. `"8.3"`. Uses Mago's default when empty.`mago.threads`*(unset)*windowNumber of threads for linting, formatting, and analysis. Uses Mago's default when unset.`mago.allowUnsupportedPhpVersion``false`resourceAllow using an unsupported PHP version without an error.`mago.noVersionCheck``false`windowSilence the project version drift warning.`mago.noAnalyzer``false`resourceDisable the static analyzer. Hover types, completion, inlay hints, and code lenses will be degraded or unavailable.`mago.noLinter``false`resourceDisable the linter. No lint diagnostics or quick-fix code actions.`mago.noFormatter``false`resourceDisable the formatter. Format Document will be unavailable for PHP files.`mago.logLevel``"info"`windowOutput channel verbosity: `error`, `warn`, `info`, `debug`, or `trace`.`mago.maxRestartCount``5`windowMaximum automatic restarts after a server crash before giving up.`mago.hideStatusBarWhenIdle``false`windowHide the status bar item when the server is idle.`mago.trace.server``"off"`windowTrace LSP communication between VS Code and the server: `off`, `messages`, or `verbose`.`suppressExperimentalWarning``false`applicationSuppress the warning popup shown at startup reminding you that the Mago language server is experimental and has no stability guarantees.Commands
--------

[](#commands)

CommandDescription**Mago: Restart Language Server**Stop and restart the server (picks up configuration changes).**Mago: Stop Language Server**Stop the server without restarting.**Mago: Show Output Channel**Open the Mago output panel for logs and diagnostics.Automatic restarts
------------------

[](#automatic-restarts)

The extension watches `mago.toml` across the workspace and restarts the server whenever the file is created, modified, or deleted. It also restarts when you switch to a file in a different workspace folder.

Conflict detection
------------------

[](#conflict-detection)

If another Mago-related extension is active (e.g. `Michael4d45.mago-vscode` or `kgz.mago-unofficial`), this extension will warn you about potential duplicate diagnostics and offer to open the Extensions view.

Troubleshooting
---------------

[](#troubleshooting)

**"Mago executable not found"**Ensure `mago` is on your `PATH`, or set `mago.executablePath` to the full path of the binary. Verify it was built with LSP support:

```
mago-lsp language-server --help
```

If the subcommand is missing, reinstall with `composer require clearlyip/mago-lsp`.

**Server crashes immediately or produces no diagnostics**Open the output channel (**Mago: Show Output Channel**) and set `mago.logLevel` to `debug` or `trace`. Validate your config with `mago config` in the workspace root.

**Duplicate diagnostics**Another extension may be running Mago in parallel. Check the conflict warning at activation and disable the conflicting extension.

Building the extension
----------------------

[](#building-the-extension)

```
npm install
npm run compile       # development build
npm run check         # type-check and lint
npm run package       # production bundle
```

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance93

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

6

Last Release

44d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ec0eab735e90845e372e877f867df9d50957c7aeb79437b13863aa1d299e188?d=identicon)[tm1000](/maintainers/tm1000)

---

Top Contributors

[![tm1000](https://avatars.githubusercontent.com/u/564256?v=4)](https://github.com/tm1000 "tm1000 (32 commits)")

---

Tags

analysisformatterlintermagophpstaticdev

### Embed Badge

![Health badge](/badges/clearlyip-mago-lsp/health.svg)

```
[![Health](https://phpackages.com/badges/clearlyip-mago-lsp/health.svg)](https://phpackages.com/packages/clearlyip-mago-lsp)
```

###  Alternatives

[symfony/runtime

Enables decoupling PHP applications from global state

74298.8M1.1k](/packages/symfony-runtime)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5345.4M570](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2124.7M205](/packages/drupal-core-project-message)[sandersander/composer-link

Adds ability to link local packages for development with composer

98457.9k](/packages/sandersander-composer-link)[phpro/grumphp-shim

GrumPHP Phar distribution

294.7M342](/packages/phpro-grumphp-shim)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

43785.5k4](/packages/lullabot-drainpipe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
