PHPackages                             jamescowie/composer-patcher - 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. jamescowie/composer-patcher

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jamescowie/composer-patcher
===========================

Apply patches using composer

2216812[2 issues](https://github.com/jamescowie/composer-patcher/issues)[1 PRs](https://github.com/jamescowie/composer-patcher/pulls)PHP

Since May 15Pushed 7y ago2 watchersCompare

[ Source](https://github.com/jamescowie/composer-patcher)[ Packagist](https://packagist.org/packages/jamescowie/composer-patcher)[ RSS](/packages/jamescowie-composer-patcher/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Patcher
=======

[](#patcher)

Applying generic patches using the `patch` tool using Composer's `script` feature.
The patching is idempotent as much as the `patch` tool is, meaning patches will *not* be re-applied if `patch` decides not to.

Project setup
-------------

[](#project-setup)

a) Patches need to be declared in the `extra` config area of Composer (root package only):

```
    "extra": {
        "magento-root-dir": "public",
        "patches": {
            "patch-group-1": {
                "patch-name-1": {
                    "type": "patch",
                    "title": "Allow composer autoloader to be applied to Mage.php",
                    "url": "https://url/to/file1.patch"
                }
            },
            "patch-group-2": {
                "patch-name-1": {
                    "title": "Fixes Windows 8.1",
                    "url": "https://url/to/file2.patch"
                }
            },
            "shell-patch-group-1": {
                "magento-shell-patch-name-1": {
                    "type": "shell",
                    "title": "Magento security fix",
                    "url": "https://url/to/magento/shell/patch.sh"
                }
            }
        }
    }
```

There are two types of patches:

- type **"patch"** - generic patch/diff files, applied using the patch tool;
- type **"shell"** - official Magento shell patches, which are able to apply and/or revert themselves and are self-contained.

If no type is declared, **"patch"** is assumed. If you have such a patch type declared, you **must** set the **"magento-root-dir"**extra config, pointing to the Mage root folder, or else it will fail with an error.

"Shell" patches will be copied in the Mage root (set by the **"magento-root-dir"** extra config), triggered, then removed.

A patch's *group* and *name* will create its ID, used internally (i.e. `patch-group-1/patch-name-1`), so make sure you follow these 2 rules:

- `patch-group-1` MUST be unique in the `patches` object literal
- `patch-name-1` MUST be unique in its patch *group*

Examples of patch groups: "magento", "drupal", "security". Examples of patch names: "CVS-1", "composer-autoloader".

b) Additional scripts callbacks need to be added for automatic patching on `install` or `update` (root package only):

```
  "scripts": {
    "post-install-cmd": "Inviqa\\Command::patch",
    "post-update-cmd": "Inviqa\\Command::patch"
  }
```

You can use whatever [Composer *Command* event](https://getcomposer.org/doc/articles/scripts.md#event-names) you want, or even [trigger the events manually](https://getcomposer.org/doc/articles/scripts.md#running-scripts-manually).
Again, note that only *Command events* are supported. Please check the above link to see which ones are they.

c) the `patch` tool must be available

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c670d717efa603797551406bb3dcbf49db7b34ee0b722c24b61152de2278a7b?d=identicon)[jamescowie](/maintainers/jamescowie)

---

Top Contributors

[![adragus-inviqa](https://avatars.githubusercontent.com/u/13104649?v=4)](https://github.com/adragus-inviqa "adragus-inviqa (14 commits)")[![jamescowie](https://avatars.githubusercontent.com/u/912476?v=4)](https://github.com/jamescowie "jamescowie (3 commits)")[![nevvermind](https://avatars.githubusercontent.com/u/834932?v=4)](https://github.com/nevvermind "nevvermind (2 commits)")

### Embed Badge

![Health badge](/badges/jamescowie-composer-patcher/health.svg)

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

###  Alternatives

[kongulov/nova-tab-translatable

Making Nova Tab Translatable

8559.5k2](/packages/kongulov-nova-tab-translatable)

PHPackages © 2026

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