- How do I install Mago for a Laravel project via Composer?
- Run `composer require carthage-software/mago` to install Mago. No Laravel-specific dependencies are required, but ensure your project’s PHP version (8.1+) is supported. Follow the [official installation guide](https://mago.carthage.software/guide/installation) for additional setup steps like Rust toolchain requirements.
- Can Mago replace PHP-CS-Fixer, Psalm, and PHPStan in a Laravel project?
- Yes, Mago consolidates formatting (like PHP-CS-Fixer), static analysis (like Psalm/PHPStan), and linting into a single CLI tool. Start by migrating one tool at a time—e.g., replace `php-cs-fixer` with `mago format`—and gradually adopt its rules via `mago.toml`.
- Does Mago support Laravel-specific static analysis (e.g., Blade templates, Eloquent queries)?
- Mago’s default rules cover core PHP issues, but Laravel-specific checks (e.g., Blade syntax, Eloquent misuse) may require custom rules. These can be written in Mago’s Rust-based DSL or configured in `mago.toml`. Check the [custom rules documentation](https://mago.carthage.software/guide/rules) for examples.
- Will Mago slow down my Laravel CI pipeline?
- No—Mago is significantly faster than PHP-based alternatives due to its Rust core. Benchmarks show it processes large Laravel codebases in seconds. For CI, use GitHub Actions recipes or parallelize linting/analysis jobs to minimize runtime.
- How do I configure Mago to work with Laravel’s Blade templates?
- Blade files are analyzed by default, but you may need to adjust rules for template-specific concerns (e.g., `@inject` or dynamic components). Use `mago.toml` to exclude or customize rules for Blade files, or extend Mago’s AST parser to handle Laravel Blade directives.
- Are there IDE plugins for VS Code or PhpStorm to integrate Mago?
- Mago provides VS Code and Helix extensions for real-time linting/formatting. For PhpStorm, use the built-in CLI integration to run `mago analyze` or `mago format` via external tools. No native PhpStorm plugin exists yet, but the CLI works seamlessly with Laravel’s IDE tooling.
- How does Mago handle false positives in Laravel’s dynamic features (e.g., magic methods, dynamic properties)?
- Mago’s static analysis is designed to minimize false positives, but Laravel’s dynamic features (e.g., `__get()`, `__call()`) may trigger edge cases. Tune rules via `mago.toml` or suppress specific warnings using `// mago:ignore` comments. Report issues to the [Mago GitHub repo](https://github.com/carthage-software/mago) for improvements.
- Can I use Mago in a Laravel Forge/Envoyer deployment workflow?
- Yes, Mago supports deployment-time checks. Add `mago analyze --no-cache` to your Forge/Envoyer deployment scripts to validate code quality before release. Its CLI output integrates with CI/CD tools for failure handling.
- What Laravel versions does Mago officially support?
- Mago supports Laravel 8+ (PHP 8.1+) out of the box. For older Laravel versions (e.g., 7.x), ensure compatibility by testing with your project’s PHP version. Mago’s Rust core is language-agnostic, so it works with any PHP-based Laravel app.
- Are there alternatives to Mago for Laravel static analysis?
- Yes, alternatives include PHPStan, Psalm, and Infection for testing. However, Mago uniquely combines linting, formatting, and static analysis in a single Rust-powered tool, reducing dependency sprawl. It’s ideal for teams wanting a modern, high-performance replacement for multiple tools.