Applying generic patches using the patch tool using Composer's script feature.
The patching is idempotent as much as the patch tool is, meaning patches will not be re-applied if patch decides not to.
a) Create composer-patches directory in project root.
b) Place .patch patches in composer-patches
c) Additional scripts callbacks need to be added for automatic patching on install or update (root package only):
"scripts": { "post-install-cmd": "Inviqa\\Command::patch", "post-update-cmd": "Inviqa\\Command::patch" }You can use whatever Composer Command event you want, or even trigger the events manually.
Again, note that only Command events are supported. Please check the above link to see which ones are they.
d) the patch tool must be available