Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mago Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Mago is a toolchain for PHP that aims to provide a set of tools to help developers write better code.

Frequently asked questions about Mago
How do I install Mago for a Laravel project via Composer?
Run `composer require carthage-software/mago` to install Mago. After installation, configure it via `mago.toml` in your project root. Mago integrates seamlessly with Laravel’s existing tooling stack, so no additional Laravel-specific setup is required beyond defining rules in the config file.
Does Mago support Laravel’s latest versions (e.g., Laravel 10, 11) and PHP 8.2+?
Yes, Mago officially supports PHP 8.1+ and works with all Laravel versions from 8.2 onward. It includes Laravel-specific rules for Blade templates, Eloquent queries, and service providers, ensuring compatibility with modern Laravel applications.
Can Mago replace PHPStan, PHP-CS-Fixer, and Psalm in a Laravel project?
Absolutely. Mago consolidates the functionality of PHPStan (static analysis), PHP-CS-Fixer (formatting), and Psalm (type checking) into a single, faster toolchain. You can disable redundant tools like PHPStan or Psalm after validating Mago’s rule coverage matches your project’s needs.
How does Mago’s performance compare to PHPStan or PHP-CS-Fixer in CI/CD?
Mago is significantly faster due to its Rust-based architecture. Benchmarks show it processes large Laravel codebases in under half the time of PHPStan + PHP-CS-Fixer combined. This reduces CI/CD runtime and improves developer productivity, especially for teams with strict build time constraints.
What Laravel-specific rules does Mago include out of the box?
Mago includes built-in rules for Blade template syntax validation, Eloquent query optimization, service provider best practices, and typed property enforcement. These rules are designed to catch Laravel-specific issues early, such as unsafe query builder usage or improper Blade escaping.
How do I configure Mago to enforce Laravel-specific linting rules?
Add the `symfony/laravel` integration to your `mago.toml` file under the `[rules]` section. Example: `[rules.laravel] enabled = true`. This enables Blade, Eloquent, and other Laravel-specific checks. You can also customize severity levels for each rule.
Will Mago break existing Laravel codebases or require major refactoring?
No, Mago is designed to be non-breaking. It adheres to Laravel’s coding standards and PHP best practices without enforcing strict rules that would require refactoring. Start with a baseline configuration and gradually introduce stricter rules to avoid disrupting legacy code.
How can I integrate Mago into my Laravel CI pipeline (GitHub Actions, GitLab CI, etc.)?
Add a step to run `mago lint` and `mago analyze` in your CI workflow. Example for GitHub Actions: `- name: Run Mago run: vendor/bin/mago lint --fix && vendor/bin/mago analyze`. Configure thresholds for allowed violations to ensure code quality gates are met before merging.
Are there any alternatives to Mago for Laravel projects?
Yes, alternatives include PHPStan (static analysis), PHP-CS-Fixer (formatting), and Psalm (type checking). However, Mago combines all three into a single, faster toolchain with Laravel-specific integrations. If you prefer modular tools, you can still use PHPStan or Psalm alongside Mago for specialized checks.
How do I handle false positives in Mago’s static analysis for a large Laravel codebase?
Use Mago’s `--exclude` flag to bypass problematic files or directories temporarily. For recurring false positives, adjust rule severity in `mago.toml` or contribute fixes to Mago’s rule set. Start with a baseline configuration and refine it over time as your team identifies patterns.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo