Sometimes, you may encounter a bug or an unwanted functionality in a PHP vendor dependency, and forking the package and maintaining upstream changes can be too cumbersome. In such cases, using composer-patches is a good solution.
Composer-patches is a handy Composer plugin that applies diff patches to specific packages during installation.
Basically, you store a diff patch in your project, specify which vendor package it should be applied to in your composer.json
, and the plugin will apply the patch to the original code of the vendor package after it got installed by composer.