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

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

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.

6.0.1(2mo ago)2994.3M—8%44[30 issues](https://github.com/vaimo/composer-patches/issues)[1 PRs](https://github.com/vaimo/composer-patches/pulls)15MITPHPPHP &gt;=7.1.0CI passing

Since Jun 7Pushed 2mo ago8 watchersCompare

[ Source](https://github.com/vaimo/composer-patches)[ Packagist](https://packagist.org/packages/vaimo/composer-patches)[ RSS](/packages/vaimo-composer-patches/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (24)Versions (212)Used By (15)

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)

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
- [Environment Variables](./docs/ENVIRONMENT.md) - Environment variables to change plugin behavior
- [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; // patched by composer-patches
         /**
          * rest of the logic of the function
          */
```

As a good practice you might want to add a hint, that the file was patched.

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.

Composer 1
----------

[](#composer-1)

After officially dying in late 2025, hopefully this is not a concern for many, but in case you do need the patcher with Composer 1, we're suggesting using version 5.5.4 of the package. This is the last version where we've been able to verify Composer 1 support. Version 5 may still receive some updates, and we try to make sure they're backwards compatible, but means to verify this have become very limited.

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance83

Actively maintained with recent releases

Popularity62

Solid adoption and visibility

Community39

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor2

2 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 ~16 days

Recently: every ~54 days

Total

202

Last Release

77d ago

Major Versions

3.53.2 → 4.22.22021-02-24

3.53.3 → 4.22.32021-02-24

3.53.4 → 4.22.42021-02-25

4.22.4 → 5.0.02022-05-13

5.6.0 → 6.0.02026-02-03

PHP version history (3 changes)3.0.0PHP &gt;=5.3.0

5.0.0PHP &gt;=7.0.0

5.3.1PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/695d3feefa2118fb7005d5c6b3bbccb2e164ab48bb1a3eb64b3e7595298ce9e4?d=identicon)[vaimo](/maintainers/vaimo)

---

Top Contributors

[![jooname](https://avatars.githubusercontent.com/u/36262953?v=4)](https://github.com/jooname "jooname (97 commits)")[![allanpaiste](https://avatars.githubusercontent.com/u/3738135?v=4)](https://github.com/allanpaiste "allanpaiste (82 commits)")[![cweagans](https://avatars.githubusercontent.com/u/101590?v=4)](https://github.com/cweagans "cweagans (37 commits)")[![zamoroka](https://avatars.githubusercontent.com/u/9164112?v=4)](https://github.com/zamoroka "zamoroka (11 commits)")[![LionsAd](https://avatars.githubusercontent.com/u/354804?v=4)](https://github.com/LionsAd "LionsAd (6 commits)")[![adamj88](https://avatars.githubusercontent.com/u/1053393?v=4)](https://github.com/adamj88 "adamj88 (5 commits)")[![peterjaap](https://avatars.githubusercontent.com/u/431360?v=4)](https://github.com/peterjaap "peterjaap (4 commits)")[![KDederichs](https://avatars.githubusercontent.com/u/24696606?v=4)](https://github.com/KDederichs "KDederichs (4 commits)")[![zamoroka-vaimo](https://avatars.githubusercontent.com/u/51359266?v=4)](https://github.com/zamoroka-vaimo "zamoroka-vaimo (3 commits)")[![c33s](https://avatars.githubusercontent.com/u/649209?v=4)](https://github.com/c33s "c33s (3 commits)")[![KonstantinKuklin](https://avatars.githubusercontent.com/u/573586?v=4)](https://github.com/KonstantinKuklin "KonstantinKuklin (3 commits)")[![mougrim](https://avatars.githubusercontent.com/u/1057709?v=4)](https://github.com/mougrim "mougrim (3 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (3 commits)")[![ukgodzuki](https://avatars.githubusercontent.com/u/240904750?v=4)](https://github.com/ukgodzuki "ukgodzuki (3 commits)")[![v-r](https://avatars.githubusercontent.com/u/5349259?v=4)](https://github.com/v-r "v-r (3 commits)")[![indykoning](https://avatars.githubusercontent.com/u/15870933?v=4)](https://github.com/indykoning "indykoning (2 commits)")[![einokeskitalovaimo](https://avatars.githubusercontent.com/u/263320080?v=4)](https://github.com/einokeskitalovaimo "einokeskitalovaimo (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![DonCallisto](https://avatars.githubusercontent.com/u/7060632?v=4)](https://github.com/DonCallisto "DonCallisto (1 commits)")[![michaelarnauts-dstny](https://avatars.githubusercontent.com/u/203100616?v=4)](https://github.com/michaelarnauts-dstny "michaelarnauts-dstny (1 commits)")

---

Tags

appliercomposercomposer-commandscomposer-extensioncomposer-packagescomposer-pluginconstraintsmaintenancepatch-extensionpatcherpatchespatchingpluginpluginutilitytoolsmaintenanceutilsutilitiescomposer-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/vaimo-composer-patches/health.svg)

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

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

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

A PHP library for creating and validating commit messages according to the Conventional Commits specification. Includes a CaptainHook action!

1931.2M122](/packages/ramsey-conventional-commits)[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[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)
