Search by

amateescu / mago-drupal

amateescu

Mago extension for Drupal. Linter rules and analyzer plugins that know the Drupal conventions.

Package info

github.com/amateescu/mago-drupal

pkg:composer/amateescu/mago-drupal

Statistics

Installs: 42

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

0.5.0 2026-09-22 15:58 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, phpunit and phpstan-ignores analyzer plugins type and report, and their limits.
  • Coming from Coder: every sniff of Coder's Drupal and DrupalPractice standards, 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.neon moves to Mago.
  • Development: the checks, the test corpus and building the docs.

License

MIT.