PHPackages                             rajeshreeputra/composer-dynamic-patches - 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. rajeshreeputra/composer-dynamic-patches

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

rajeshreeputra/composer-dynamic-patches
=======================================

Provides a way to patch Composer packages dynamically.

1.0.0(8mo ago)13[1 PRs](https://github.com/rajeshreeputra/composer-dynamic-patches/pulls)GPL-2.0-or-laterPHPPHP &gt;=8.0.0

Since Mar 10Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/rajeshreeputra/composer-dynamic-patches)[ Packagist](https://packagist.org/packages/rajeshreeputra/composer-dynamic-patches)[ RSS](/packages/rajeshreeputra-composer-dynamic-patches/feed)WikiDiscussions develop Synced 3d ago

READMEChangelog (1)Dependencies (4)Versions (4)Used By (0)

composer-dynamic-patches
========================

[](#composer-dynamic-patches)

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

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)

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

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

```
{
    "name": "rajeshreeputra/package",
    "type": "metapackage",
    "require": {
        "vendor/package-patches": "~1.0"
    },
    "extra": {
        "patches": {
            "vendor/package-patches": [
                {
                    "This is patch 1": "url/to/file1.patch",
                    "This is patch 2": "url/to/file2.patch"
                }
            ]
        }
    }
}
```

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

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

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

---

composer.json:

```
{
    "name": "rajeshreeputra/package",
    "type": "metapackage",
    "require": {
        "vendor/package-patches": "~1.0"
    },
    "extra": {
        "patches": {
            "vendor/package-patches":     {
                "1.0.0": {
                    "This is patch 1.0.0 - 1": "url/to/file1.patch",
                    "This is patch 1.0.0 - 2": "url/to/file2.patch"
                },
                "1.0.5": {
                    "This is patch 1.0.5 - 1": "url/to/file1.patch",
                    "This is patch 1.0.5 - 2": "url/to/file2.patch"
                },
                "1.1.2": {
                    "This is patch 1.1.2 - 1": "url/to/file1.patch",
                    "This is patch 1.1.2 - 2": "url/to/file2.patch"
                }
                "1.1.*": {
                    "This is patch 1.1.* - 1": "url/to/file1.patch",
                    "This is patch 1.1.* - 2": "url/to/file2.patch"
                }
            }
        }
    }
}
```

**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):

```
{
    "name": "rajeshreeputra/package",
    "type": "project",
    "require": {
        "vendor/package-patches": "~1.0"
    },
    "extra": {
        "patches-file": "url/to/file/patch.json"
    }
}
```

```
{
    "vendor/package-patches": {
        "1.0.0": {
            "This is patch 1.0.0 - 1": "url/to/file1.patch",
            "This is patch 1.0.0 - 2": "url/to/file2.patch"
        },
        "1.0.5": {
            "This is patch 1.0.5 - 1": "url/to/file1.patch",
            "This is patch 1.0.5 - 2": "url/to/file2.patch"
        },
        "1.1.2": {
            "This is patch 1.1.2 - 1": "url/to/file1.patch",
            "This is patch 1.1.2 - 2": "url/to/file2.patch"
        }
        "1.1.*": {
            "This is patch 1.1.* - 1": "url/to/file1.patch",
            "This is patch 1.1.* - 2": "url/to/file2.patch"
        }
    }
}
```

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:

```
{
    "name": "rajeshreeputra/package",
    "type": "project",
    "require": {
        "vendor/package-patches": "~1.0"
    },
    "extra": {
        "patches": {
            "vendor/package-patches": {
                "This is local patch": "./patches/file.patch"
            }
        }
    }
}
```

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

```
# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/src/SomeFile.php
+++ b/src/SomeFile.php
@@ -6,7 +6,7 @@
 	{
 		// apply patch to
 		// next line
-		// This is old line
+		// This is new line
 		// some text
 		// some text
 		// some text

```

*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 prl
composer prp

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance61

Regular maintenance activity

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~602 days

Total

2

Last Release

245d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf9286059c516fb6258ae1c7433a7b37d66eae22b456c6ed21feda2f4aeb1ace?d=identicon)[rajeshreeputra](/maintainers/rajeshreeputra)

---

Top Contributors

[![rajeshreeputra](https://avatars.githubusercontent.com/u/19570710?v=4)](https://github.com/rajeshreeputra "rajeshreeputra (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rajeshreeputra-composer-dynamic-patches/health.svg)

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

###  Alternatives

[symfony/runtime

Enables decoupling PHP applications from global state

74798.8M1.0k](/packages/symfony-runtime)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5445.2M565](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2124.7M203](/packages/drupal-core-project-message)[sandersander/composer-link

Adds ability to link local packages for development with composer

98457.9k](/packages/sandersander-composer-link)[phpro/grumphp-shim

GrumPHP Phar distribution

294.7M340](/packages/phpro-grumphp-shim)

PHPackages © 2026

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