A PHP toolchain, oxidized.
Mago is a static analyzer, linter, and formatter for PHP, written in Rust. Built for projects that have outgrown the patience of their tooling.
Three tools, one binary
Static analysis
Find bugs, dead code, and impossible types before they ship. Compatible with Psalm and PHPStan annotations; understands generics, conditional types, and flow narrowing.
Opinionated linting
A curated catalogue of rules for correctness, consistency, and clarity. Fix-on-save where safe. Quiet where it should be.
Formatter
A deterministic formatter that produces stable, conventional output. No configuration roulette, no debate. Drop in and move on.
Benchmarks
Measured against WordPress on the latest stable release of every tool. Lower is better; the "×" column shows how many times slower the slowest peer is compared to Mago. Numbers refresh from the php-toolchain-benchmarks dashboard (full mean / stddev / max / memory breakdown there), last updated 2026-04-15 02:47:37.
| Operation | Mago | Peer A | Peer B | × |
|---|---|---|---|---|
| Static analysis | 1.46s | Phan 66.4s | PHPStan 55.9s | 45 |
| Linting | 0.88s | PHP-CS-Fixer 25.3s | 29 | |
| Formatting | 0.43s | Pretty PHP 24.3s | 56 |
Install
curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash
Three steps to first run
- Install. One command. No PHP runtime required. Single static binary.
- Initialize. Run
mago initin your project root. Mago detects your layout and writes amago.toml. - Run. Use
mago analyze,mago lint, ormago fmt. Wire it into pre-commit, CI, or your editor.
Sponsors
Mago is free and open source, built and maintained by Seifeddine Gmati with support from these companies and individuals.
Want to support Mago's development?
Become a sponsorTry it without installing
The playground runs the full Mago analyzer in your browser via WebAssembly. Paste any PHP, share the result by URL.