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

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

iweb/composer-patches
=====================

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

4.20.2.2(5y ago)011.5k1MITPHPPHP &gt;=5.3.0

Since Jun 7Pushed 5y agoCompare

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

READMEChangelog (2)Dependencies (10)Versions (175)Used By (0)

Vaimo Composer Patches
======================

[](#vaimo-composer-patches)

[![Latest Stable Version](https://camo.githubusercontent.com/70137d0398000560357a10335c2cd4e7d5f8a0993b3ae8bd80cbaff06a478b20/68747470733a2f2f706f7365722e707567782e6f72672f7661696d6f2f636f6d706f7365722d706174636865732f762f737461626c65)](https://packagist.org/packages/vaimo/composer-patches)[![Build Status](https://camo.githubusercontent.com/af370e342a60395941a28057b1671cc460a5f899ea43e399b5f6be7d8c784aa8/68747470733a2f2f7472617669732d63692e6f72672f7661696d6f2f636f6d706f7365722d706174636865732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vaimo/composer-patches)[![Total Downloads](https://camo.githubusercontent.com/8a7c684e62289f49bbd82ce632ca5b3efad21a209e4e46fb2b957a5dfd5abebd/68747470733a2f2f706f7365722e707567782e6f72672f7661696d6f2f636f6d706f7365722d706174636865732f646f776e6c6f616473)](https://packagist.org/packages/vaimo/composer-patches)[![Daily Downloads](https://camo.githubusercontent.com/6eec521dd82e9eb00cb3010faf69d5aded9aad4a073667921ef6d9bfb58748ae/68747470733a2f2f706f7365722e707567782e6f72672f7661696d6f2f636f6d706f7365722d706174636865732f642f6461696c79)](https://packagist.org/packages/vaimo/composer-patches)[![Minimum PHP Version](https://camo.githubusercontent.com/eca4c170c20132469e1d9e7e1980154abc589868eb46084c1b47513504b62643/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7661696d6f2f636f6d706f7365722d706174636865732e737667)](https://php.net/)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a492c2d79c1f9a199b848d5d4259c848d6cc08db1fcc320aae11881eb10e4d87/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7661696d6f2f636f6d706f7365722d706174636865732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vaimo/composer-patches/?branch=master)[![Code Climate](https://camo.githubusercontent.com/e0d54f03bebfd357b2b345b8c19740a442e1540b752c50334c3659869042acac/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f7661696d6f2f636f6d706f7365722d706174636865732f6261646765732f6770612e737667)](https://codeclimate.com/github/vaimo/composer-patches)[![License](https://camo.githubusercontent.com/140e66cd8331eeba101484ce281ab6e819762ba123f49dde0d471018d1814073/68747470733a2f2f706f7365722e707567782e6f72672f7661696d6f2f636f6d706f7365722d706174636865732f6c6963656e7365)](https://packagist.org/packages/vaimo/composer-patches)

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level in package config or separate JSON file. Declaration-free mode (using embedded info within patch files) is available as well.

The way the patches are applied (the commands, pre-checks) by the plugin is fully configurable (including the actual commands that are executed to apply the patch) from the composer.json of the project.

Note that the plugin is kept on very old PHP version as legacy software is usually the most common context where patches are needed.

Full Documentation
------------------

[](#full-documentation)

- [Basic Usage](./docs/USAGE_BASIC.md) - Defining patches via configuration files or embedded metadata
- [Advanced Usage](./docs/USAGE_ADVANCED.md) - Advanced usage options when defining patches
- [Configuration](./docs/CONFIGURATION.md) - Configuration options for the patch applier
- [Commands](./docs/COMMANDS.md) - Details on the CLI commands that ship with the plugin
- [Error Handling](./docs/ERRORS.md) - Handling encountered errors
- [Development](./docs/DEVELOPMENT.md) - Details on the development workflow of the plugin
- [Examples](./docs/EXAMPLES.md) - Examples on usage of the plugin
- [Changes](./CHANGELOG.md) - List of changes/fixes per plugin release

Quick Start
-----------

[](#quick-start)

Composer packages can be targeted with patches in two ways:

- Embedded metadata (recommended default approach)
- JSON declaration and embedded (recommended for remote patches)

### Usage: Embedded Metadata

[](#usage-embedded-metadata)

```
{
  "require": {
    "some/package-name": "1.2.3"
  },
  "extra": {
    "patcher": {
      "search": "patches"
    }
  }
}
```

Contents of patches/changes.patch:

```
This patch changes...
absolutely everything

@package some/package-name

--- Models/Example.php.org
+++ Models/Example.php
@@ -31,7 +31,7 @@
      */
     protected function someFunction($someArg)
     {
-        $var1 = 123;
+        $var1 = 456;
         /**
          * rest of the logic of the function
          */
```

Full list of tag options (that cover all features of the plugin can be found [HERE](./docs/USAGE_BASIC.md#embedded-metadata)).

Note that tags cover most of the features of the module so every explanation given for the json declaration of the patches applies for tags as well.

### Usage: JSON Declaration

[](#usage-json-declaration)

```
{
  "require": {
    "some/package-name": "1.2.3"
  },
  "extra": {
    "patches": {
      "some/package-name": {
        "This patch changes ... absolutely everything": "patches/changes.patch",
        "remote patch": "http://www.example.com/remote-patch.patch",
        "remote patch with checksum check": {
          "source": "http://www.example.com/other-patch.patch",
          "sha1": "5a52eeee822c068ea19f0f56c7518d8a05aef16e"
        }
      }
    }
  }
}
```

Contents of patches/changes.patch:

```
--- Models/Example.php.org
+++ Models/Example.php
@@ -31,7 +31,7 @@
      */
     protected function someFunction($someArg)
     {
-        $var1 = 123;
+        $var1 = 456;
         /**
          * rest of the logic of the function
          */
```

### Applier Configuration

[](#applier-configuration)

The way patches are applied can be manipulated by changing the configuration of the patcher or by introducing additional patch appliers.

In most cases there should not be much of a need to reconfigure the module as it does ship with reasonable defaults. The appliers supported by default: patch, git.

More information on said topic can be found [HERE](./docs/CONFIGURATION.md).

Upgrades
--------

[](#upgrades)

When upgrading the module, one might encounter odd crashes about classes not being found or class constructor arguments being wrong.

This usually means that the class structure or constructor footprint in some of the classes have changed after the upgrade which means that the plugin might be running with some classes from the old and some classes from the new version.

Due to the fact that the patcher kicks in very late in the process of installing a project (before auto-loader generation), developers are advised to re-execute `composer install`.

Ideally, plugins should always be updated with explicit `--no-plugins` flag added to the `composer update`call to avoid issues that plugin usage with potentially mixed logic from two different plugin releases being in use.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 55.2% 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 ~8 days

Recently: every ~149 days

Total

173

Last Release

1829d ago

Major Versions

3.50.2 → 4.19.22019-09-02

3.50.3 → 4.19.32019-09-05

3.51.0 → 4.20.02019-09-16

3.51.1 → 4.20.12019-09-24

3.51.2 → 4.20.22019-09-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/d845bbc2af2a4c52e352fca6b7b4ba886f4edb0040ac49478e1bbd7fec63ba56?d=identicon)[tom-iweb](/maintainers/tom-iweb)

---

Top Contributors

[![cweagans](https://avatars.githubusercontent.com/u/101590?v=4)](https://github.com/cweagans "cweagans (37 commits)")[![fabianx-ai](https://avatars.githubusercontent.com/u/354804?v=4)](https://github.com/fabianx-ai "fabianx-ai (6 commits)")[![ukgodzuki](https://avatars.githubusercontent.com/u/240904750?v=4)](https://github.com/ukgodzuki "ukgodzuki (3 commits)")[![mougrim](https://avatars.githubusercontent.com/u/1057709?v=4)](https://github.com/mougrim "mougrim (3 commits)")[![KonstantinKuklin](https://avatars.githubusercontent.com/u/573586?v=4)](https://github.com/KonstantinKuklin "KonstantinKuklin (3 commits)")[![v-r](https://avatars.githubusercontent.com/u/5349259?v=4)](https://github.com/v-r "v-r (3 commits)")[![tom-iweb](https://avatars.githubusercontent.com/u/30152765?v=4)](https://github.com/tom-iweb "tom-iweb (2 commits)")[![pivulic](https://avatars.githubusercontent.com/u/7068697?v=4)](https://github.com/pivulic "pivulic (1 commits)")[![valga](https://avatars.githubusercontent.com/u/23472603?v=4)](https://github.com/valga "valga (1 commits)")[![bsod85](https://avatars.githubusercontent.com/u/9477994?v=4)](https://github.com/bsod85 "bsod85 (1 commits)")[![yched](https://avatars.githubusercontent.com/u/193080?v=4)](https://github.com/yched "yched (1 commits)")[![c33s](https://avatars.githubusercontent.com/u/649209?v=4)](https://github.com/c33s "c33s (1 commits)")[![dave1010](https://avatars.githubusercontent.com/u/50682?v=4)](https://github.com/dave1010 "dave1010 (1 commits)")[![diazwatson](https://avatars.githubusercontent.com/u/1080386?v=4)](https://github.com/diazwatson "diazwatson (1 commits)")[![einokeskitalovaimo](https://avatars.githubusercontent.com/u/263320080?v=4)](https://github.com/einokeskitalovaimo "einokeskitalovaimo (1 commits)")[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (1 commits)")[![h3rj4n](https://avatars.githubusercontent.com/u/738683?v=4)](https://github.com/h3rj4n "h3rj4n (1 commits)")

---

Tags

pluginutilitytoolsmaintenanceutilsutilitiescomposer-pluginpatchingbackportsFixesversion restrictionindirect restrictionspatch descriptionremote patch filesdownloaded patchespackage bug-fixpackage patchespatch exclusiondevelopment patcheshot-fixeshotfixesenvironment flagsskipped packagespatch skippingmaintenance toolsmultiple formatspatch branchingmulti-version patchesbundled patchespatch commandos-specific configconfigurable patch applierback-portsbulk patchespatch headerpatch meta-dataresolve patchespatch searchpatch resolvepatchercomposer command

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[cse/helpers-session

The helpers allows you to easily manage session data. START, SET, GET DELETE, HAS method session - all this is available in this library.

102.6k3](/packages/cse-helpers-session)

PHPackages © 2026

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