2

I want to know that can we create patch for some changes in composer.json of custom module. I am talking about custom module composer not magento composer. Its just like changes but instead of any php file i want to do it in composer.json. Is there a different way? I am using the same old way but its not working.

diff --git a/composer.json b/composer.json

--- a/composer.json

+++ b/composer.json

4
  • What are you trying to achieve?
    – Akif
    Aug 30, 2022 at 10:36
  • I want to change the version in composer.json by patch Aug 30, 2022 at 11:09
  • What is the idea behind it? If you explain what the root issue is which you are trying to solve, it would be easier to help.
    – Akif
    Aug 30, 2022 at 11:33
  • So i want to install an extension but that only works on php 7.3 ( req in composer of module) But my M 2.4.5 works on php 7.4. so i want to change the php version in the req tag of composer.json of extension with patch Aug 30, 2022 at 11:36

2 Answers 2

0

As an aswer on:

So i want to install an extension but that only works on php 7.3 ( req in composer of module) But my M 2.4.5 works on php 7.4. so i want to change the php version in the req tag of composer.json of extension with patch

You could try those suggestion:

  1. The easiest way would be to just install the module without composer in app/code. Copy them from vendor in the right structure. This way you skip any version checks.
  2. You could experiment with the --ignore-platform-reqs flag of composer. It will skip the platform requirements checks but I am not sure if you could use it with composer require. You might need to install it first on a platform which does meet the requirements and then do composer install --ignore-platform-reqs to install it from the lock file on the machine which does not meet the requirements.

Good luck!

0

Looks like you are missing the index in your patch file.

In some cases patch files created by diff -u do not work. You should follow @attila-naghi steps except step 5 (redundant) to get the patch file: https://magento.stackexchange.com/a/315195/39884

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.