carthage-software/mago
Mago is an extremely fast PHP linter, formatter, and static analyzer written in Rust. It brings speed, reliability, and a great developer experience to PHP projects of all sizes.
non-existent-class-like detection in @var docblocks, generic type parameter preservation on instanceof narrowing, and false-positive elimination on sealed/unsealed array unions translate directly into fewer runtime surprises after refactors. A PM can sequence "legacy module modernization" behind analyzer adoption as a prerequisite gate.enforce-class-finality, require-api-or-internal, single-class-per-file, file-name) let a PM convert unwritten team conventions into CI-enforced policy without a written style guide that nobody reads.{ code = "missing-return-type", in = "tests/" }) and per-rule exclusions (exclude = ["src/Legacy/"]) allow incremental adoption — enforce strictness on new code (src/) while grandfathering app/Legacy/ or tests/. This is the difference between a rollout that ships and one that stalls on 4,000 pre-existing violations.code-count reporting with severity levels gives a PM a metric for a dashboard — "violations trending from X to Y over the quarter" — which is otherwise hard to source for "quality" workstreams.Adopt when:
mago.toml) rather than four, to reduce the "which tool flagged this?" support load.src/ code first.@psalm-mutation-free interop and type-alias resolution reduce migration friction.@api/@internal) as an organizational policy, not just a style preference.Look elsewhere or defer when:
For executives: Mago is a single, fast, open-source (Apache-2.0) PHP quality toolchain — linter, formatter, and static analyzer — that replaces three to four overlapping tools in our CI. It cuts analysis time materially (Rust core vs. PHP-implemented tooling), converts our style and design conventions into enforced policy, and gives us a quantifiable code-health metric. Zero license cost, no vendor lock-in, adoptable incrementally behind path scoping so the migration is not a big-bang rewrite. Risk is bounded: it's dev-only, never ships to production, and version-pinning makes adoption reversible.
For engineering leadership: The rollout is low-risk and staged. Phase 1 — install in CI and pre-commit, run in report-only mode, measure baseline violations. Phase 2 — enable auto-fixes and formatting on a scoped path. Phase 3 — enforce analyzer errors on new code, grandfathering legacy directories via path-scoped ignores. We protect existing PHPStan/Psalm custom rules by running in parallel until parity is demonstrated on our codebase. Config lives in one mago.toml under version control. Success metrics: CI analysis wall-time, violation count trend, reviewer time on style nits, and pre-existing-bug catch rate in refactor PRs.
For the team: Faster local feedback (format/lint in the editor loop rather than waiting on CI), automatic fixes for many lint issues so review comments stop being about formatting, deeper type analysis that catches real bugs (undefined classes, impossible unions, wrong array keys), and opt-in design checks if we want them. It's not a black box — --only flags, per-rule path exclusions, and severity-aware reporting mean we can tune it to us rather than the reverse.
How can I help you explore Laravel packages today?