Install
Works with Drupal: ^11.2Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
First public release of Extension Guard.
Drupal validates a module's dependencies only at the moment that module is installed, and never again. When a package update adds a dependency to a module you already have installed, that dependency is downloaded but never turned on, and no core or Drush command reports it. The problem stays invisible until a later deployment fails, naming a module that is usually unrelated to the cause.
This release provides three ways to catch that.
What is included
- A guard on
drush config:export. The export is refused if any installed module has a dependency that is not installed. The message names the module that declares the dependency, lists everything depending on it, and prints the exactdrush pm:installcommand to fix it. This runs at the moment that matters, becausedrush cexis what people already run aftercomposer update. - A read-only command,
drush extension-guard:check. Reports the same information and exits non-zero. Intended for CI, and for auditing a production site without exporting anything. - A status report entry. Implemented with
hook_runtime_requirements(), so an existing inconsistency is visible at Reports, then Status report, without running any command. - Detection of malformed dependency declarations. An info.yml whose dependency list is written without the leading hyphen is parsed as plain text and silently discarded by Drupal, so the dependency is never enforced at all. This is a bug in the module being scanned rather than site configuration drift, so it is reported as a warning and does not block anything.
Configuration
None is required. Two optional settings live in extension_guard.settings:
ignored_modulesrecords deliberate exceptions, for cases where an upstream module declares a dependency that duplicates something the site already provides.enforce_on_config_importextends the guard todrush config:import. It is off by default, because that command runs insidedrush deployand a site with a pre-existing problem would find its deployments blocked without warning.
A single invocation can be bypassed with the EXTENSION_GUARD_SKIP environment variable.
Requirements
- Drupal 11.2 or later. The module uses
hook_runtime_requirements()and theRequirementSeverityenum. - Drush 13. This is a hard requirement: the export guard is implemented as a Drush command validator. Sites that do not use Drush will get the status report entry only.
Why alpha
The functionality is complete and has been verified by hand against a large production codebase, where it found four genuine unmet dependencies and one malformed declaration in a widely used contributed module. It is marked alpha because there is no automated test coverage yet, and because the configuration keys and the Drush command name may still change in response to early feedback.
Known limitations in this release:
- No administrative interface. Settings are managed through configuration only.
- No kernel or functional tests.
- Version constraints in dependency declarations are not evaluated. Only presence is checked.
Feedback
Bug reports are particularly welcome. This module reads dependency data from every extension on a site, and real sites contain declarations stranger than anything that could be invented in testing. If it reports something you believe is wrong, or misses something it should catch, please open an issue.