Tools
Mago ships several tools in one binary. Each command chooses its parser and rules. Tools share file settings and reports.
Formatter
A deterministic code formatter. It produces stable, conventional output that follows PER-CS by default and supports presets for PSR-12, Laravel, and Drupal style. No configuration roulette, no debate.
Linter
A curated catalogue of rules covering correctness, consistency, clarity, redundancy, safety, security, and a few other concerns. Most issues come with an automatic fix. Framework integrations layer on rules specific to Symfony, Laravel, PHPUnit, Doctrine, and others.
Analyzer
A static analysis engine that catches type errors and logic bugs before runtime. Compatible with Psalm and PHPStan annotations, with support for generics, conditional types, and flow narrowing.
Architectural guard
Enforces dependency rules and structural conventions. Useful when you want to forbid certain use paths, codify layer boundaries, or assert that code in one part of the project never imports code from another.
Twig formatter
mago twig:fmt formats Twig syntax with its own [twig.formatter] settings. It keeps template text unchanged and does not rewrite HTML. The PHP formatter and mago fix do not run it.
Twig linter
mago twig:lint checks Twig templates with its own rules and settings. It supports native reports, baselines, pragmas, staged files, stdin, and safe fixes. The PHP commands do not run Twig lint rules.