Apply quality patches and hotfixes

You can install quality patches on both cloud infrastructure and on-premises installations using the vendor/bin/magento-patches apply command. You must ensure that the vendor/bin/magento-patches apply command runs after composer install operations.

NOTE
On cloud infrastructure, you can also install quality patches by listing them in your project’s .magento.env.yaml file. The example described here requires using the vendor/bin/magento-patches apply command.

You can specify the patches to apply in the composer.json file of a custom Composer component package, then create a plugin package that runs the command after composer install operations.

To summarize, this centralized patching example requires you to create two custom Composer packages:

  • Component package: centralized-patcher

    • Defines the list of quality patches and m2-hotfixes to install
    • Requires the centralized-patcher-composer-plugin package, which runs the vendor/bin/magento-patches apply command after composer install operations
  • Plugin package: centralized-patcher-composer-plugin

    • Defines a CentralizedPatcher PHP class that reads the quality patches list from the centralized-patcher package
    • Runs the vendor/bin/magento-patches apply command to install the list of quality patches after composer install operations