Install

Works with Drupal: ^11.2

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 14.61 KB
MD5: ef07a24fae78ad3aea811e01dacc5635
SHA-1: 43073933638e3618cafb47145d1bcb134eb6ec91
SHA-256: 414c5f46d865e092caf18e4e9f9d18f498e4761250c13771a810236894a7753b
Download zip 20.21 KB
MD5: b22aaa64a2beb91a96c98371caef79f3
SHA-1: 9e3a4a2d4a6bba3464a87415cb10609463cfaace
SHA-256: 6752f018416315b043c7be96006d152694ee940e5d3b663884df40d5e330a78c

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 exact drush pm:install command to fix it. This runs at the moment that matters, because drush cex is what people already run after composer 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_modules records deliberate exceptions, for cases where an upstream module declares a dependency that duplicates something the site already provides.
  • enforce_on_config_import extends the guard to drush config:import. It is off by default, because that command runs inside drush deploy and 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 the RequirementSeverity enum.
  • 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.

Created by: sardis
Created on: 13 Aug 2026 at 17:35 UTC
Last updated: 13 Aug 2026 at 17:35 UTC
New features

Other releases