DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How I can apply a patch to specific files depending the installed version of a composer dependency

In my php projects I want to develop and apply patches relatively fast.

Therefore I want to use this approach:

In my case I want once I do:

composer install

After the dependencies being downloaded to replace some files in vendor based upon a json names hotpatch.json and will have theese entries:


{
  "my_dependency":{
     "v1.1":[
          {
            "original":"./vendor/my_dependency/app/Myclass.php"
            "replacement":"./hotpatch/my_dependency/app/v1/Myclass.php"
          }
     ]
  }
}

Or in case a php version and extention…

Is there a way to do this?

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay