digipolisgent / qa-drupal
Quality Assurance tools and configuration for Drupal websites and extensions.
Requires
- php: ^8.3
- behat/mink: ^1.13
- behat/mink-browserkit-driver: ^2.3
- drupal/coder: ^9.0
- drupal/core: ^11.1 || ^12.0
- ergebnis/composer-normalize: ^2.52
- friendsoftwig/twigcs: ^6.5
- lullabot/mink-selenium2-driver: ^1.7.4
- lullabot/php-webdriver: ^2.0.7
- mglaman/phpstan-drupal: ^2.0.15
- nette/neon: ^3.4
- pdepend/pdepend: ^2.16.1 || 3.x-dev
- phpcompatibility/php-compatibility: ^10.0@alpha
- phpmd/phpmd: ^2.15 || 3.x-dev
- phpro/grumphp-shim: ^2.0
- phpspec/prophecy: ^1.23
- phpspec/prophecy-phpunit: ^2.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpunit/phpunit: ^10.5.19 || ^11.5 || ^12.5
- symfony/phpunit-bridge: ^7.2 || ^8.1
- systemsdk/phpcpd: ^7.0.1 || ^8.0 || ^9.0
Requires (Dev)
None
Suggests
- drupal/drupal-extension: Install ^6.1 to enable the optional Behat integration on Drupal 11; Drupal 12 is not supported until Drupal Extension supports Symfony 8.
Provides
None
Conflicts
None
Replaces
None
- dev-develop
- 5.0.0
- 4.x-dev
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 4.0.0-alpha6
- 4.0.0-alpha5
- 4.0.0-alpha4
- 4.0.0-alpha3
- 4.0.0-alpha2
- 4.0.0-alpha1
- 3.x-dev
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.x-dev
- 2.1.1
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.8.1
- 1.8.0
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.15
- 1.4.14
- 1.4.13
- 1.4.12
- 1.4.11
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.12
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
- 0.1.0
- dev-feature/qa-php-3-integration
- dev-main
- dev-4.x-dev
- dev-3.x-dev
- dev-2.x-dev
This package is auto-updated.
Last update: 2026-09-11 15:25:43 UTC
README
This package provides Quality Assurance tools and shared configuration for Drupal websites and extensions (modules, themes, and profiles).
Requirements and compatibility
- Composer
- PHP 8.3 or later
- Drupal 11.1 or later, or Drupal 12
| Drupal | PHP | Notes |
|---|---|---|
^11.1 |
^8.3 |
PHP 8.3 and 8.4 are supported throughout this Drupal range. Use Drupal 11.3 or later for PHP 8.5 support. |
^11.3 |
^8.3 |
Includes the Drupal 11 releases that support PHP 8.5. |
^12.0 |
^8.5 |
Drupal 12 requires PHP 8.5. Behat is not currently available for this combination. |
QA Drupal 5.x intentionally drops Drupal 10 and PHP versions older than 8.3. See UPGRADE-5.x.md before updating an existing project.
Installation
Installation depends on whether the consuming project is a Drupal website or a Drupal extension.
Drupal website
Add the grumphp entry to the extra section of the project's composer.json:
"grumphp": { "config-default-path": "vendor/digipolisgent/qa-drupal/configs/grumphp-site.yml" }
Install QA Drupal as a development dependency:
composer require --dev digipolisgent/qa-drupal:^5.0
Drupal extension
Add the grumphp entry to the extra section of the extension's
composer.json:
"grumphp": { "config-default-path": "vendor/digipolisgent/qa-drupal/configs/grumphp-extension.yml" }
Install QA Drupal as a development dependency:
composer require --dev digipolisgent/qa-drupal:^5.0
Behat support
Behat is optional in QA Drupal 5.x. It is no longer installed or run by the default GrumPHP test suite. The shared Behat configuration, custom contexts, and scaffold files remain available so Drupal 11 projects can opt in.
Drupal Extension 6.1 restricts its Symfony dependencies to Symfony 6 and 7, while Drupal 12 requires Symfony 8. Installing both therefore creates an unresolvable dependency conflict. Behat cannot be supported on Drupal 12 until Drupal Extension publishes a Symfony 8 compatible release. Default Behat support can be reconsidered once that upstream support exists.
Drupal 11 projects can enable the retained integration with:
composer require --dev --with-all-dependencies drupal/drupal-extension:^6.1
Then add the Behat task to the project's GrumPHP override:
grumphp: testsuites: tests: tasks: - phpunit - behat tasks: behat: config: behat.qa-drupal.yml
Run GrumPHP once to generate behat.qa-drupal.yml. Copy
vendor/digipolisgent/qa-drupal/scaffold/behat.local.yml.dist to
behat.local.yml and adapt its base URL for the local Drupal site.
The Mink and browser-driver dependencies used by Drupal's PHPUnit browser tests remain part of the package. Their presence does not enable Behat by itself.
Configuration
General
To extend or override a task's shared configuration, create the matching file
in the project root. For example, create phpcs.xml or phpcs.local.xml to
override the provided PHPCS configuration.
Use .local. files only for changes that should not be committed and exclude
them in .gitignore:
/*.local.*
YAML and NEON files extend the provided configuration by default. To omit one
configuration layer, add the following variable to .env or .env.local:
[FILENAME]_SKIP_[TYPE]=1
[FILENAME] is the task configuration filename and [TYPE] is one of:
LOCAL: skip a file such asphpstan.local.neon.PROJECT: skip a file such asphpstan.neon.PACKAGE_TYPE: skip a provided file such asphpstan-extension.neonorphpstan-site.neon.PACKAGE_GLOBAL: skip a provided file such asphpstan.neon.
Other file types cannot be merged and the most specific available file is copied instead.
Composer security audit
The default pre-commit suite uses GrumPHP's native
securitychecker_composeraudit task. It audits the locked dependency versions
through Composer and replaces the removed Enlightn security checker.
PHPStan in deprecations-only mode
Create phpstan.neon with the following contents to ignore everything except
deprecations:
parameters: customRulesetUsed: true ignoreErrors: - '#^(?:(?!deprecated).)*$#'
Generated configuration files
Some GrumPHP tasks require a configuration file. QA Drupal creates these files
from its shared configuration and project-specific overrides. Files with a
.qa-drupal. suffix are generated in the project root and must not be
committed:
/*.qa-drupal.*
PHPUnit coverage reports and its cache should also be ignored:
/build /.phpunit.cache
To run PHPUnit locally without coverage, copy phpunit.qa-drupal.xml to
phpunit.local.xml and remove the <coverage> section from the local copy.
Run GrumPHP
GrumPHP runs the configured tasks on changed code during Git commit and push. Run all tasks manually with:
vendor/bin/grumphp
Run selected tasks with:
vendor/bin/grumphp --tasks phpcs,phpmd vendor/bin/grumphp --tasks phpunit
PhpStorm
Run GrumPHP successfully at least once to generate the configuration files used by PhpStorm:
phpcs.qa-drupal.xmlphpmd.qa-drupal.xmlphpunit.qa-drupal.xml
Configure them under PHP quality tools and PHPUnit test-runner settings in the IDE.
Code Climate
Configure Code Climate to use the QA Drupal PHPCS rules:
prepare: fetch: - url: "https://raw.githubusercontent.com/district09/php_package_qa-drupal/5.x/configs/phpcs-codeclimate.xml" path: ".phpcs.xml" plugins: phpcodesniffer: enabled: true channel: beta config: standard: ".phpcs.xml"
PHP compatibility
The PHPCompatibility rules can explicitly check the complete package PHP range:
php vendor/bin/phpcs -p --ignore="*/vendor/*" --extensions=php,inc,module,install,theme --runtime-set testVersion 8.3-8.5 --standard=PHPCompatibility ./web/modules/contrib