jordankaiser
2/4/2019 - 3:21 PM

Apply drupal patch with composer

{
  // etc above ...
  "extra": {
    "patches": {
        "drupal/webform": {
          "Field no longer required after editing.": "https://www.drupal.org/files/issues/2019-01-30/3029543-6.patch"
        }
    },
  }
  // etc below....
}

Apply a patch to a drupal module using composer.

Apply patch

  1. In composer.json add the new object to extra.patches.
  2. Run composer install
  3. If everything went well then you need to tell the composer.lock file to update itself with the new patch.
  4. Run composer update --lock if so.

Remove patch

  1. Remove the patch from extra.patches.
  2. Run composer install
  3. Update composer.lock by runing composer update --lock.
  4. This might not work. In which case just rm -rf the module and rerun composer install.

JSON documentation

{
  "extra": {
    "patches": {
        "path/to/module": {
          "Description": "https://link.com/to/patch"
        }
    },
  }
 }

path/to/module - Same as it is in the require object. Description - Title of issue thread. https://link.com/to/patch - Link to patch file from issue thread.