Source: Cognimatic Blog

Cognimatic Blog How to Apply Patches in Drupal 8 & 9 with Composer

Apply patches in Drupal 8/9 with composer-patches plugin, then specifying URL of patch file (typically from drupal.org) in composer.jsonInstall Composer https://getcomposer.org/download/Install Drupal and desired modules using Composer drupal.org guide composer create-project drupal/recommended-projectInstall relevant modules, for example composer require drupal/yearonlyInstall Cameron Eagans patches plugin using composer require cweagans/composer-patchesEdit composer.json extra section and add in the the patches section immediately after "installer-paths" as below, using the URL of the patch file [from drupal.org]:"patches":  {    "drupal/yearonly": {      "Token types missing name property": "https://www.drupal.org/files/issues/2019-05-02/token_missing-2951179-4.patch"    },  },"enable-patching": true, Run composer update to apply patches - Composer will delete the modules to be patched, then re-download them with patches applied.Add more patches to composer.json as required. You can remove these entries if the module is released with an official patch There's a detailed guide on installing patches to Drupal 8 with Composer, but has a crucial missing step at https://www.anexusit.com/blog/how-to-apply-patches-drupal-8-composer Tweet

Read full article »
Est. Annual Revenue
$100K-5.0M
Est. Employees
1-25
CEO Avatar

CEO

Update CEO

CEO Approval Rating

- -/100