carthage-software / mago
Mago is a toolchain for PHP that aims to provide a set of tools to help developers write better code.
Fund package maintenance!
azjezz
Installs: 138 389
Dependents: 10
Suggesters: 0
Security: 0
Stars: 523
Watchers: 8
Forks: 33
Open Issues: 31
Language:Rust
Type:composer-plugin
Requires
- php: ~8.1 || ~8.2 || ~8.3 || ~8.4
- composer-plugin-api: ^2.6
Requires (Dev)
- composer/composer: ^2.8
- dev-main
- 1.0.0-alpha.3
- 1.0.0-alpha.2
- 1.0.0-alpha.1
- 0.26.1
- 0.26.0
- 0.25.0
- 0.24.5
- 0.24.4
- 0.24.3
- 0.24.2
- 0.24.1
- 0.24.0
- 0.23.0
- 0.22.2
- 0.22.1
- 0.22.0
- 0.21.0
- 0.20.4
- 0.20.3
- 0.20.2
- 0.20.1
- 0.20.0
- 0.19.5
- 0.19.4
- 0.19.3
- 0.19.2
- 0.19.1
- 0.19.0
- 0.18.1
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.1
- 0.13.0
- 0.12.0
- 0.11.1
- 0.11.0
- 0.10.0
- 0.9.1
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.1
- 0.5.0
- 0.4.1
- 0.4.0
- dev-analyzer-2
- dev-chore/alloc
- dev-feat/using-rfc
- dev-feat/lsp
This package is auto-updated.
Last update: 2025-08-07 00:25:18 UTC
README
An extremely fast PHP linter, formatter, and static analyzer, written in Rust.
Mago is a comprehensive toolchain for PHP that helps developers write better code. Inspired by the Rust ecosystem, Mago brings speed, reliability, and an exceptional developer experience to PHP projects of all sizes.
Table of Contents
How to Install
Shell (Linux, macOS)
# with curl curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash # with wget wget -qO- https://carthage.software/mago.sh | bash
Package Managers
Homebrew (macOS)
brew install mago
Composer (PHP Project)
composer require --dev carthage-software/mago
Cargo (Rust Toolchain)
cargo install mago
Manual Download
You can download pre-compiled binaries for your system from the GitHub Releases page.
Getting Started
Once installed, you can start using Mago immediately.
- Lint your project:
mago lint src/
- Format your code:
mago format src/
For detailed usage, configuration options, and available rules, please visit the Mago Documentation.
Features
- β‘οΈ Extremely Fast: Built in Rust for maximum performance.
- π Lint: Identify issues in your codebase with customizable rules.
- π¬ Static Analysis: Perform deep analysis of your codebase to catch potential type errors and bugs.
- π οΈ Automated Fixes: Apply fixes for many lint issues automatically.
- π Formatting: Automatically format your code to adhere to best practices and style guides.
- π§ Semantic Checks: Ensure code correctness with robust semantic analysis.
- π³ AST Visualization: Explore your codeβs structure with Abstract Syntax Tree (AST) parsing.
Contributing
Mago is a community-driven project, and we welcome contributions! Whether you're reporting bugs, suggesting features, writing documentation, or submitting code, your help is valued.
- See our Contributing Guide to get started.
- Join the discussion on Discord.
Inspiration & Acknowledgements
Mago stands on the shoulders of giants. Our design and functionality are heavily inspired by pioneering tools in both the Rust and PHP ecosystems.
Inspirations:
- Clippy: For its comprehensive linting approach.
- OXC: A major inspiration for building a high-performancetoolchain in Rust.
- Hakana: For its deep static analysis capabilities.
Acknowledgements:
We deeply respect the foundational work of tools like PHP-CS-Fixer, Psalm, PHPStan, and PHP_CodeSniffer. While Mago aims to offer a unified and faster alternative, these tools paved the way for modern PHP development.
License
Mago is dual-licensed under your choice of the following:
- MIT License (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)