amateescu / mago-drupal
Mago extension for Drupal. Linter rules and analyzer plugins that know the Drupal conventions.
0.5.0
2026-09-22 15:58 UTC
Requires
- php: ^8.1
- carthage-software/mago: ^1.47.1
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.5 || ^12.0 || ^13.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-21 10:22:17 UTC
README
A Mago extension that adds
Drupal's coding standards to the Mago
linter, and teaches the Mago analyzer what Drupal's services, entities, config and plugins hand
back. With mago format and Mago's own rules, it replaces phpcs and Coder for the PHP files of a
Drupal project. The parity target is
Coder 9.
Quick start
PHP 8.1 or later and Mago 1.58 or later are required.
composer require --dev carthage-software/mago amateescu/mago-drupal
Then create mago.toml next to vendor/:
extends = "vendor/amateescu/mago-drupal/drupal.mago.toml" # The lowest PHP version that the project supports. php-version = "8.3"
For a Drupal core checkout, extend drupal-core.mago.toml instead. Then run the linter and the
analyzer:
vendor/bin/mago lint vendor/bin/mago analyze
Documentation
- Setup: the install, what the config files set, the worker's arguments and the fix levels.
- Linter rules: every rule, with what it reports, what its fix does, the section of Drupal's coding standards or the source checked by the rule, and the Coder checks ported by the rule.
- Analyzer: what the
drupal,phpunitandphpstan-ignoresanalyzer plugins type and report, and their limits. - Coming from Coder: every sniff of Coder's
DrupalandDrupalPracticestandards, and what takes its place. - Coming from PHPStan: every rule and extension of phpstan-drupal, the
PHPStan identifiers reported by Mago too, and how a
phpstan.neonmoves to Mago. - Development: the checks, the test corpus and building the docs.
License
MIT.