I would like to know how to specify a patch inside a module's composer file.

The scenario is like this:

On my Drupal 9 site, I want to run the command composer require module. The module composer file, has dependencies and 2 modules specified there, are not yet ported to Drupal 9 but there have been patches created (not sure if the modules will be ported soon since they kind of seem a bit abandoned).

What I did, I modified the composer file of the module I want to install to look like this:

enter image description here

But, the patches do not apply so when I run the command composer require module I get told that google_analytics_reports is not D9 compatible. I am 100% sure that the patch I am trying to apply makes it compatible. Not sure what I've been missing. If I apply the patch in the Drupal's composer, it works, but I want a standalone module.

If it helps, the error is just the generic one: module requires drupal/google_analytics_reports 3.0.0-beta3 -> satisfiable by drupal/google_analytics_reports[3.0.0-beta3]. (which requires D8 and so on)

  • Not all patches can apply successfully against latest stable version. Try using the dev version of the module. – No Sssweat Jun 9 at 7:02
  • Sadly the patches are not yet committed to dev (were not last time I checked). – Lia Jun 9 at 7:06
  • 2
    To clarify, apply patch to the dev version. – No Sssweat Jun 9 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.