An extension for Mago, the PHP linter, formatter and static analyzer. It adds Drupal's coding standards to Mago and gives its analyzer the types of Drupal's APIs. Together with Mago's own formatter, rules and analyzer, it replaces phpcs, Coder, PHPStan and phpstan-drupal in a Drupal project.
It provides:
- Linter rules for the parts of Drupal's coding standards that aren't checked by Mago's own rules. Many of them have a fix. The rules aim for parity with Coder 9.
- Analyzer plugins with the types of Drupal's services, entities, config and plugins, and checks for Drupal-specific mistakes, such as a service that doesn't exist.
- A config preset with Mago's settings for a Drupal project.
Installation
PHP 8.1 or later and Mago 1.58.1 or later are required.
composer require --dev carthage-software/mago "drupal/mago:^1.0@alpha"Then create a mago.toml file, see Install.
Usage
vendor/bin/mago lint vendor/bin/mago lint --fix vendor/bin/mago analyzeThe documentation has the setup, every rule, the analyzer's types and checks, and the maps from Coder and PHPStan.
Ask your assistant about Mago
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-alpha1 | Pre-release | Nov 13, 2026 | |||
| 1.x-dev | Dev | Nov 13, 2026 |