manubing/composer-drupal-module-handler

Tries to properly uninstall Drupal modules before removing them.

Installs: 3 616

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Type:composer-plugin

pkg:composer/manubing/composer-drupal-module-handler

dev-master 2021-02-01 15:06 UTC

This package is auto-updated.

Last update: 2025-12-29 02:32:34 UTC


README

About

This composer-plugin contains a plugin witch tries to properly uninstall a Drupal module before Composer attempts to remove it.

This plugin is intended to be used with a composer-managed Drupal project, eg: drupal-composer/drupal-project

It should eliminate the need of two-steps uninstall/removing process.

How it works

This plugin listens the prePackageUninstall Composer event. In case of a package of type drupal-module being removed, it tries to:

  • Bootstrap Drupal
  • Invoke the Module Installer service to uninstall the module

If this plugin can't proceed, Composer will still remove the package.

Installation

composer require manubing/composer-drupal-module-handler

No configuration required 🎊

Configuration

If no configuration is provided, this package will use default values matching drupal-composer/drupal-project:

  • Drupal app_root defaults to {COMPOSER_DIR}/../web
  • Drupal site_path defaults to {app_root}/sites/default

However, if your project have a different directory structure, use the composer.json extra section:

{
  "extra": {
    "drupal-project": {
      "app-root": "html",
      "site-path": "sites/some-site"
    }
  }
}

Note

This plugin does not currently support multisites projects.

Credits

  • Supporting organization : Accelys