carthage-software/mago
Mago is an extremely fast PHP linter, formatter, and static analyzer written in Rust. It helps teams catch issues early, enforce consistent style, and improve code quality across projects, with multiple install options like script, Homebrew, Composer, and Cargo.
Code Quality & Maintainability:
--fix for common issues (e.g., formatting, minor syntax errors), accelerating PR reviews and CI/CD pipelines.Developer Experience (DX):
Scalability & Cost:
mago.toml) simplify adoption and maintenance.--semantics) for quick wins, then layer in linting/rules incrementally (e.g., disable rules via enabled = false in mago.toml during migration).Roadmap Alignment:
Tooling Fragmentation is Painful:
Performance is a Bottleneck:
Framework-Specific Rules Are Critical:
Illuminate\Container rules).#[Route] annotations or Laravel’s use App\ namespace prefixes.Semantic Safety is a Priority:
enum in PHP < 8.1) before runtime, but php -l is too limited.Automated Fixes Save Time:
return types) are a bottleneck in PR reviews.Gradual Migration is Needed:
Your Stack is Non-PHP:
eslint (JS) or pylint (Python).You Need Deep Business Logic Analysis:
Your Team Resists Configuration Changes:
.php-cs-fixer.dist.php/phpstan.neon to mago.toml. If stakeholders prefer minimal tooling changes, stick with incremental improvements to existing tools.You’re in a Highly Regulated Environment:
Your Codebase is Tiny or Trivial:
Problem: "Our code quality tools are fragmented, slow, and inconsistent. Developers spend time fixing style issues or debugging syntax errors that could be caught automatically. This slows down releases and increases technical debt."
Solution: "Mago is a single, ultra-fast PHP toolchain (written in Rust) that replaces 5+ tools (PHP-CS-Fixer, Psalm, PHPStan, etc.) with one CLI. It:
ROI:
Risk Mitigation:
Problem:
"Running php-cs-fixer, phpstan, and psalm in CI takes 10 minutes. Local linting is slow. And we still get PRs with PHP version mismatches or style violations."
Solution: "Mago is a drop-in replacement that:
--fix.enum in PHP 8.0) before runtime.use App\ namespace enforcement).mago.toml) instead of 3+ configs."*Key Features to Highlight:
| Feature | Benefit |
|---|---|
| Rust Performance | Linting in <1s for 50K+ LoC (vs. 5–10s with PHP tools). |
| Automated Fixes | --fix resolves trailing commas, docblocks, and minor syntax issues. |
| Semantic Checks | Catches PHP version/syntax errors (e.g., match in PHP 8.0). |
| Framework Integrations | Laravel/Symfony/PHPUnit-specific rules (e.g., route annotation checks). |
| AST Visualization | Debug complex refactoring with Abstract Syntax Tree tools. |
| Gradual Adoption | Start with --semantics (fast PHP syntax checks), then add linting. |
Migration Path:
mago lint --semantics).--fix for style issues.**Try
How can I help you explore Laravel packages today?