Mago/PHP toolchain/Carthage Software

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.

§ 01

Three tools, one binary

01 / Analyze

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.

1.46s · 7M LOC
02 / Lint

Opinionated linting

A curated catalogue of rules for correctness, consistency, and clarity. Fix-on-save where safe. Quiet where it should be.

0.88s · same project
03 / Format

Formatter

A deterministic formatter that produces stable, conventional output. No configuration roulette, no debate. Drop in and move on.

0.43s · same project
§ 02

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.

OperationMagoPeer APeer 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

Read the full methodology →

§ 03

Install

[ INSTALL ]shell · macOS · Linux · WSL
curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash
§ 04

Three steps to first run

  1. Install. One command. No PHP runtime required. Single static binary.
  2. Initialize. Run mago init in your project root. Mago detects your layout and writes a mago.toml.
  3. Run. Use mago analyze, mago lint, or mago fmt. Wire it into pre-commit, CI, or your editor.
§ 05

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 sponsor

Try it without installing

The playground runs the full Mago analyzer in your browser via WebAssembly. Paste any PHP, share the result by URL.

Open the playground