carthage-software/mago
Mago is an extremely fast PHP linter, formatter, and static analyzer written in Rust. It brings Rust-inspired speed and reliability to PHP projects with a modern toolchain and great developer experience, plus multiple install options (script, Homebrew, Composer).
Strengths:
Gaps:
bind() methods).Laravel Ecosystem Compatibility:
--ignore flags or .magoignore).php artisan mago:lint).--reporting-format=github) simplifies PR feedback integration.Toolchain Overlap:
High:
__call(), dynamic properties). Requires tuning via mago analyze --level or custom rules.Mitigation:
NoHardcodedRoutes, ValidateServiceBindings) to reduce false positives.--check mode initially to avoid breaking changes.Laravel-Specific Needs:
blade-analyzer.)CI/CD Impact:
Developer Experience:
Long-Term Viability:
.magoignore to focus on PHP logic.Phase 1: Linting & Formatting (Low Risk)
mago fmt and mago lint..mago.php to match Laravel’s PSR-12 rules.Phase 2: Static Analysis (Medium Risk)
mago analyze in CI with --level=3 (strict) and triage false positives.NoDirectModelInstantiation).Phase 3: Advanced Features (High Risk)
phpunit.xml).composer install runs before mago analyze.| Step | Action | Tools Affected | Risk |
|---|---|---|---|
| 1. Setup | Install Mago via Composer or Docker. | - | Low |
| 2. Configure | Create .mago.php with Laravel-specific rules. |
PHP-CS-Fixer | Low |
| 3. CI Integration | Add mago fmt --check and mago lint to GitHub Actions. |
CI/CD | Low |
| 4. Static Analysis | Run mago analyze --level=1 in CI; iterate on false positives. |
Psalm/PHPStan | Medium |
| 5. Custom Rules | Develop rules for Laravel patterns (e.g., route validation). | Custom | High |
| 6. IDE Setup | Configure VSCode/PHPStorm to use Mago for linting. | IDE | Low |
| 7. Advanced | Enable AST visualization; integrate with testing. | PestPHP, Debugbar | High |
mago lint --fix, mago analyze --level=2).--reporting-format=json for programmatic error handling in CI.How can I help you explore Laravel packages today?