Getting Started
For mago CLI documentation — formatting rules, linter configuration, and analysis options — see mago on GitHub.
Requirements
- VS Code 1.75 or later
- mago CLI installed and accessible
Installation
From the VS Code Marketplace (recommended)
- Open VS Code
- Press
⌃⇧X(⌘⇧Xon MacOS) to open the Extensions panel - Search for "Mago PHP Toolchain"
- Click Install
Or install from the command line:
❯ code --install-extension kellymears.vscode-mago
Build from source
❯ git clone https://github.com/kellymears/vscode-mago
❯ cd vscode-mago
❯ npm install && npm run build
❯ npx vsce package
# Install the .vsix
❯ code --install-extension vscode-mago-*.vsix
Quick Setup
- Install the mago binary in your project or globally:
# Via Composer (project-local)
❯ composer require carthage-software/mago
# Or download the binary directly
# See https://github.com/carthage-software/mago
- Open a PHP project in VS Code.
- The extension activates automatically when a PHP file is opened.
- Set Mago as your default PHP formatter:
Binary Resolution
The extension searches for the mago binary in the following order, using the first executable it finds:
mago.binsetting — explicit path in VS Code settings./vendor/bin/mago— Composer local install./mago— binary in workspace root- System
$PATH— global install
If none are found, the extension shows an error notification. Set mago.bin in your configuration to use a specific path.
Verify
Open a PHP file and check the status bar — you should see mago with the CLI version in the bottom-right. If you see an error icon, check that the binary is installed and accessible.
Open the command palette (⌃⇧P / ⌘⇧P) and type "Mago" to see all available commands.