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)