Steps
  1. find a patch URL

    1. check the module page on the drupal website, people usually provide those in issues over there
  2. add cweagans/composer-patches
    1. in root -> require: "cweagans/composer-patches": "^1.7"
    2. in root -> config -> allow-plugins: "cweagans/composer-patches": true
  3. add the patch to composer.json -> extra -> patches
    • Example

      "extra": {
          "patches": {
              "drupal/core": {
                  "Fix for disabled text formats not displaying in GUI": "https://www.drupal.org/files/issues/2022-12-09/2502637_110.patch"
              }
          }
      }

  4. composer install
Notes
  • If for whatever reason Composer refuses to apply the patch, delete the package folder and try again.