Composer Patches Plugin banner
netresearch netresearch

Composer Patches Plugin

Development community

Description

Plugin for composer to apply patches onto dependencies.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

composer-patches-plugin

This plugin allows you to provide patches for any package from any package.

Requirements

  • PHP 8.0 or higher
  • Composer 2.0 or higher

Installation

composer require netresearch/composer-patches-plugin

Compatibility

This plugin is fully compatible with:

  • Composer 2.0+ (including 2.4.4+)
  • PHP 8.0, 8.1, 8.2, 8.3

Usage

If you don't want a patch package outside the root package, consider providing it as package in the [repositories key](https://getcomposer.org/doc/04-schema.md#repositories)

{
    "name": "vendor/package",
    "type": "project",
    "repositories": [
        {
            "type": "package",
            "package": {
                "type": "metapackage",
                "name": "vendor/package-patches",
                "version": "1.0.0",
                "require": {
                    "netresearch/composer-patches-plugin": "~1.0"
                },
                "extra": {
                    "patches": {
                        "vendor/name": [
                            {
                                "url": "https://my-domain.com/path/to/my.patch"
                            }
                        ]
                    }
                }
            }
        }
    ],
    "require": {
        "vendor/package-patches": "~1.0"
    }
}

See this presentation for the original idea of this plugin: http://de.slideshare.net/christianopitz/distributed-patching-with-composer

Patch properties

Key Description Required
url The url or path to the patch
title Title to display when applying or reverting the patch
args string, which will be added to the patch command
sha1 SHA1 checksum of the patch contents for security check - when given the patches actual checksum and this value are compared and if they don't match an exception will be thrown

You may provide patches per package and optionally by version constraints:

Provi