PHPackages                             netresearch/composer-patches-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. netresearch/composer-patches-plugin

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

netresearch/composer-patches-plugin
===================================

Composer patches plugin

1.3.3(4mo ago)80270.0k↓31.4%22[1 issues](https://github.com/netresearch/composer-patches-plugin/issues)7GPL-2.0-or-laterPHPPHP ^8.0CI passing

Since Jan 21Pushed 4d ago12 watchersCompare

[ Source](https://github.com/netresearch/composer-patches-plugin)[ Packagist](https://packagist.org/packages/netresearch/composer-patches-plugin)[ RSS](/packages/netresearch-composer-patches-plugin/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (4)Versions (19)Used By (7)

composer-patches-plugin
=======================

[](#composer-patches-plugin)

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

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Composer 2.0 or higher

Installation
------------

[](#installation)

```
composer require netresearch/composer-patches-plugin
```

Compatibility
-------------

[](#compatibility)

This plugin is fully compatible with:

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

Usage
-----

[](#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:

Patch properties
----------------

[](#patch-properties)

KeyDescriptionRequired`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 thrownYou may provide patches per package and optionally by version constraints:

Provide patches by package only
-------------------------------

[](#provide-patches-by-package-only)

```
{
    "name": "netresearch/typo3-patches",
    "version": "1.0.0",
    "type": "metapackage",
    "require": {
        "netresearch/composer-patches-plugin": "~1.0"
    },
    "extra": {
        "patches": {
            "typo3/cms": [
                {
                    "title": "[FEATURE] Allow registration of different login forms",
                    "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539"
                },
                {
                    "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only",
                    "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786"
                }
            ]
        }
    }
}
```

Provide patches by package and versions or version constraints
--------------------------------------------------------------

[](#provide-patches-by-package-and-versions-or-version-constraints)

---

composer.json:

```
{
    "name": "netresearch/typo3-patches",
    "version": "1.0.0",
    "type": "metapackage",
    "require": {
        "netresearch/composer-patches-plugin": "~1.0"
    },
    "extra": {
        "patches": {
            "typo3/cms":     {
                "6.2.0-beta1": [
                    {
                        "title": "[FEATURE] Allow registration of different login forms",
                        "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539"
                    },
                    {
                        "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only",
                        "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786"
                    }
                ],
                "6.2.0-beta2": [
                    {
                        "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only",
                        "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786"
                    }
                ],
                "6.2.*": [
                    {
                        "title": "[BUGFIX] Ignore dependencies on non typo3-cms-extension",
                        "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/9fe856ac96e6a53fef8277f36a4a80bace6f0ae9",
                        "sha1": "b56a1c47a67d1596c0bd8270e61c44f8911af425"
                    }
                ]
            }
        }
    }
}
```

**Note**: *When multiple version constraints match the version of the target package, all of the matching patches will be applied (canonicalized by theyr checksums, so no duplicates should occure).*

Provide patches from URLs or paths
----------------------------------

[](#provide-patches-from-urls-or-paths)

You can put any part of the patches object into another JSON and load it via an URL (or a path):

composer.json:

```
{
    "name": "netresearch/typo3-patches",
    "version": "1.0.0",
    "type": "metapackage",
    "require": {
        "netresearch/composer-patches-plugin": "~1.0"
    },
    "extra": {
        "patches": {
            "typo3/cms": "http://example.com/typo3-patches.json"
        }
    }
}
```

```
{
    "6.2.0-beta1": [
        {
            "title": "[FEATURE] Allow registration of different login forms",
            "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539"
        },
        {
            "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only",
            "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786"
        }
    ],
    "6.2.0-beta2": [
        {
            "title": "[PATCH] [BUGFIX] Flexform \"required\" on input fields applies to last field only",
            "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786"
        }
    ],
    "6.2.*": [
        {
            "title": "[BUGFIX] Ignore dependencies on non typo3-cms-extension",
            "url": "https://git.typo3.org/Packages/TYPO3.CMS.git/patch/9fe856ac96e6a53fef8277f36a4a80bace6f0ae9",
            "sha1": "b56a1c47a67d1596c0bd8270e61c44f8911af425"
        }
    ]
}
```

Provide patches from local stored files
---------------------------------------

[](#provide-patches-from-local-stored-files)

You can use absolute paths or paths relative to the application root.

composer.json:

```
"repositories": [
        {
            "type": "package",
            "package": {
                "type": "metapackage",
                "name": "vendor/package-patches",
                "version": "1.0.0",
                "require": {
                    "netresearch/composer-patches-plugin": "~1.0"
                },
                "extra": {
                    "patches": {
                        "typo3/cms":     [
                            {
                                    "title": "[FEATURE] Allow registration of different login forms",
                                    "url": "patches/example_local_file.patch"
                            }
                        ]
                    }
                }
            }
        }
    ],
   "require": {
        ....
    },
```

I have also added a new folder at the same level as the composer.json called "patches" and add a patch file example\_local\_file.patch like:

```
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/src/com/zoho/crm/library/exception/Logger.php
+++ b/src/com/zoho/crm/library/exception/Logger.php
@@ -6,7 +6,7 @@
 	{
 		set_include_path(ZCRMConfigUtil::getConfigValue('applicationLogFilePath'));
 		$path=get_include_path();
-		if($path{strlen($path)-1}!='\/')
+		if($path[strlen($path)-1]!='\/')
 		{
 			$path=$path."/";
 		}

```

*Note* that the patch will be called with the option -p1 (remove the first slash) and in the directory of the library.

Then run the commands to update the dependency and to install patches:

```
composer update vendor/package-patches
composer install

```

Requiring the patches:
----------------------

[](#requiring-the-patches)

just require the package with the patches.

```
{
    "name": "netresearch/patched-typo3",
    "type": "project",
    "description": "A patched version of typo3",
    "minimum-stability": "dev",
    "require": {
        "netresearch/typo3-patches": "~1.0",
        "typo3/cms": "6.2.0-beta3"
    }
}
```

Removing patches
----------------

[](#removing-patches)

When patches are no longer needed (e.g., they've been merged into the upstream package), you can remove them by:

1. **Update the target package** to a version that includes the fixes
2. **Remove the patch definitions** from your `composer.json` or patch package
3. **Update composer.lock**: Run `composer update` to update the lock file
4. **Remove patch files** (optional): You can now safely delete the `.patch` files

The plugin will automatically handle the transition. When updating packages, if patch files have been deleted but are still referenced in `installed.json`, the plugin will skip reverting those patches and continue with the package update.

**Note**: The plugin gracefully handles missing patch files during package updates and uninstalls. If a patch file cannot be found when reverting patches, a warning will be logged, but the operation will continue normally since the package will be reinstalled anyway.

### Example workflow for removing patches

[](#example-workflow-for-removing-patches)

```
# 1. Update the patched package to a newer version that includes the fixes
composer require vendor/package:^2.0

# 2. Remove patch definitions from composer.json extra section
# Edit your composer.json and remove the patch entries

# 3. Update composer.lock
composer update vendor/package-patches

# 4. Delete the patch files (if stored locally)
rm patches/my-old-patch.patch

# 5. Commit the changes
git add composer.json composer.lock
git commit -m "Remove patches that were merged upstream"
```

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance88

Actively maintained with recent releases

Popularity49

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~400 days

Recently: every ~625 days

Total

12

Last Release

147d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151247?v=4)[Netresearch DTT GmbH](/maintainers/netresearch)[@netresearch](https://github.com/netresearch)

---

Top Contributors

[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (24 commits)")[![CybotTM](https://avatars.githubusercontent.com/u/326348?v=4)](https://github.com/CybotTM "CybotTM (16 commits)")[![copitz](https://avatars.githubusercontent.com/u/882663?v=4)](https://github.com/copitz "copitz (15 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (14 commits)")[![rednut](https://avatars.githubusercontent.com/u/1188531?v=4)](https://github.com/rednut "rednut (7 commits)")[![JParkinson1991](https://avatars.githubusercontent.com/u/6921398?v=4)](https://github.com/JParkinson1991 "JParkinson1991 (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![c33s](https://avatars.githubusercontent.com/u/649209?v=4)](https://github.com/c33s "c33s (2 commits)")[![vergissberlin](https://avatars.githubusercontent.com/u/179964?v=4)](https://github.com/vergissberlin "vergissberlin (1 commits)")[![cweiske](https://avatars.githubusercontent.com/u/59036?v=4)](https://github.com/cweiske "cweiske (1 commits)")[![dooug](https://avatars.githubusercontent.com/u/136539?v=4)](https://github.com/dooug "dooug (1 commits)")[![dudilag](https://avatars.githubusercontent.com/u/10417029?v=4)](https://github.com/dudilag "dudilag (1 commits)")[![Gitsko](https://avatars.githubusercontent.com/u/17161911?v=4)](https://github.com/Gitsko "Gitsko (1 commits)")[![igormukhingmailcom](https://avatars.githubusercontent.com/u/6544038?v=4)](https://github.com/igormukhingmailcom "igormukhingmailcom (1 commits)")[![IllyaMoskvin](https://avatars.githubusercontent.com/u/3881840?v=4)](https://github.com/IllyaMoskvin "IllyaMoskvin (1 commits)")[![kasperg](https://avatars.githubusercontent.com/u/73966?v=4)](https://github.com/kasperg "kasperg (1 commits)")

---

Tags

composercomposer-pluginpatchesplugincomposerpatches

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/netresearch-composer-patches-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/netresearch-composer-patches-plugin/health.svg)](https://phpackages.com/packages/netresearch-composer-patches-plugin)
```

###  Alternatives

[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k41.4M2.8k](/packages/ergebnis-composer-normalize)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

576.1M124](/packages/automattic-jetpack-autoloader)[laminas/laminas-component-installer

Composer plugin for injecting modules and configuration providers into application configuration

304.4M108](/packages/laminas-laminas-component-installer)[sllh/composer-lint

Extends the composer validate command with extra rules

15227.0k7](/packages/sllh-composer-lint)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
