Store Composer Patches configuration in composer.patches.json
Introduction
Defining patches in a separate composer.patches.json file will make it easier for the developer to add and maintain patch definitions as they won’t need to search for the patch section of composer.json, and it will also reduce clutter in composer.json. New projects using composer should start with a composer.patches.json file with no patches defined in it.
To make this change, move the patches
item in composer.json
to composer.patches.json
, and replace the patches item in composer.json
with the following:
"patches-file": "composer.patches.json",
Decision
We will define patches in a separate file called composer.patches.json rather than composer.json.
Context
In composer, patches can be defined either in the main composer file or in a separate file which is referenced in the main composer file. Patches are the only commonly directly edited section of a composer.json file, so making that section easy to find improved productivity.
Consequences
- All projects have a common composer structure with patches easy to refer to.
Exceptions
- Projects not using Composer need not concern themselves with this until a change to the patches is made.
- Projects with no patches can opt to have no patches file until patches are needed.
Additional Resources
None