PHPackages                             creativestyle/composer-plugin-patchset - 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. creativestyle/composer-plugin-patchset

ActiveComposer-plugin

creativestyle/composer-plugin-patchset
======================================

Composer plugin that automatically applies patches from a patchset package

v3.0.4(11mo ago)835.9k↑176.4%51OSL-3.0PHPPHP &gt;=8.0.0CI failing

Since Jan 6Pushed 11mo ago7 watchersCompare

[ Source](https://github.com/mageops/php-composer-plugin-patchset)[ Packagist](https://packagist.org/packages/creativestyle/composer-plugin-patchset)[ RSS](/packages/creativestyle-composer-plugin-patchset/feed)WikiDiscussions v3.x Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (21)Used By (1)

[![Build Status](https://camo.githubusercontent.com/bb5fc862ebde64f075f361ca5b0bad5215f21105470208e39ad291cc32de24ac/68747470733a2f2f7472617669732d63692e6f72672f6d6167656f70732f7068702d636f6d706f7365722d706c7567696e2d70617463687365742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mageops/php-composer-plugin-patchset)

Composer Plugin For Applying Patchsets
======================================

[](#composer-plugin-for-applying-patchsets)

This plugin can automatically apply patches to any dependency of your project.

One of the most distinguishing features is that it can apply patches from special composer packages of type `patchset`. This is quite convenient as you can store all your patches in one repository and apply them automatically on all systems including developers' machines in a very predictable way. Also you can easily distribute your patchset to the whole community via packagist.

It's (kind-of) an alternative to two other great plugins:

- [netresearch/composer-patches-plugin](https://github.com/netresearch/composer-patches-plugin)
- [cweagans/composer-patches](https://github.com/cweagans/composer-patches)

**Continue reading this document for more in-depth description or skip right away directly to:**

- [Usage Documentation](docs/usage.md)
- [Creating Patches Howto](docs/creating-patches.md)
- [Testing](docs/testing.md)

Feature comparison table
------------------------

[](#feature-comparison-table)

Featurecreativestyle/composer-plugin-patchsetcweagans/composer-patches 1.xnetresearch/composer-patches-pluginApply patch collection stored in a composer packageyesnonoDeduplicate patchesyesnoTBDGuarantees proper application on the first installyesnoTBDFull functional test-suite for all featuresyesnono tests at allPHP Version Support confirmed by tests5.6+5.3+no informationApply patches directly from remote locationsno (no support planned)yesyesSpecify target package version constraintsyesnoyesUninstall removed patches in all cases1yesnoTBDReapply package patches if order has changedyesTBDTBDChoose application method (git/patch) per patchyesTBDTBDApply patches to root package/directoryyesnoTBD*1 Root package patching is the exception, please see [applying patches to root package](docs/usage.md#applying-patches-to-root-package-root-project-folder) in usage docs.*

Feature description
-------------------

[](#feature-description)

- Apply patches from dedicated composer packages (package your patchset!).
- Each patch can have a version constraint (composer semver) checked against the target package.

    This means that you can (and should) have the patches fail the build if cannot be applied and still store patches for multiple package versions in the same patchset.
- Apply patches using `patch` command and fall-back to `git apply` if not available.
- Does not reinstall packages unnecessarily.
- Reinstalls (cleans) packages which are patched but the patches have been removed guaranteeing a consistent state after multiple updates.
- Will repatch packages even if **order** of patches for specific package (version) has changed.
- Deduplicates patches on package level.
- Does not overly tie into composer internals. All patching will be done after the main update/installation process at once execution making it simpler and easier to analyze.

    This also means that you have the guarantee that the plugin / patches are at the latest version before the process even starts. Otherwise it's very tricky (if not impossible) to make the plugin behave consistently on the first composer install (e.g. no `vendor` dir at all) and the subsequent ones.

    Double composer update/install for build is not necessary.

Use Git for applying patches
----------------------------

[](#use-git-for-applying-patches)

By default the library will try to use the `patch` command if not available and fall back to `git` otherwise. You can force using git for each patch (see: [Usage Documentation](docs/usage.md)).

There were some problems using `git apply` reported in other plugins for packages that were not installed as source (did not have a git repo; `.git` dir). I was not able to reproduce this problem with git 2.X - however - a workaround for this potential problem has been implemented:

```
- If the target package has `.git` directory, then the patches are applied relative to target package root
- If no git repo in target package then patches are applied from root project directory

```

Chicken or egg problem
----------------------

[](#chicken-or-egg-problem)

Patching via composer plugin has one big problem - you cannot catch all events on the first install. Furthermore applying patches on package install/remove is very error prone as you can never predict conflicts with other plugins. Therefor gathering and applying patches before everything was actually installed carries the risk of producing invalid state at the end. This plugin takes a different approach - it performs all actions at once, after the installation/update was performed, just before autoload dump (in case patching changes it).

This guarantees a consistent state as the plugin compares the current state with the desired one and peforms only the actions necessary to get there.

**This has one drawback, if your project uses any composer plugins that copy files from vendors to the root of your project then you should patch the root package because the patch applications will happen after those plugins have done their work so patching source files in vendor will have no effect.**

Why no remote patches
---------------------

[](#why-no-remote-patches)

This plugin will not download patches from external sources directly (http). I consider this a bad practice and will never support it. I won't even comment on downloading patches using unencrypted connection without SHA check. Also what if somebody wants to use your software in 2 years and the patches are no longer available?

Also you will not be able to specify patches in any composer package. You have to use a dedicated packages for this purpose. I can hardly imagine a legit use case when it would be desirable that installing package X will automatically patch some other package Y in your project without explicitly being advertised as a patchset.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 76.6% 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 ~123 days

Recently: every ~101 days

Total

20

Last Release

344d ago

Major Versions

v1.0.6 → v2.0.02019-11-06

v2.1.0 → v3.0.22021-04-07

v2.x-dev → v3.0.02024-04-18

PHP version history (2 changes)v1.0.0PHP &gt;=5.6.0

v3.0.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6814811?v=4)[creativestyle](/maintainers/creativestyle)[@creativestyle](https://github.com/creativestyle)

---

Top Contributors

[![pinkeen](https://avatars.githubusercontent.com/u/2019132?v=4)](https://github.com/pinkeen "pinkeen (49 commits)")[![piotrmatras](https://avatars.githubusercontent.com/u/11822697?v=4)](https://github.com/piotrmatras "piotrmatras (5 commits)")[![diwipl](https://avatars.githubusercontent.com/u/3406741?v=4)](https://github.com/diwipl "diwipl (4 commits)")[![pledwig-creativestyle](https://avatars.githubusercontent.com/u/188556701?v=4)](https://github.com/pledwig-creativestyle "pledwig-creativestyle (4 commits)")[![adamkarnowka](https://avatars.githubusercontent.com/u/511845?v=4)](https://github.com/adamkarnowka "adamkarnowka (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/creativestyle-composer-plugin-patchset/health.svg)

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

###  Alternatives

[humbug/box

Fast, zero config application bundler with PHARs.

1.3k801.5k67](/packages/humbug-box)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k3](/packages/elgg-elgg)[neos/flow

Flow Application Framework

862.0M448](/packages/neos-flow)[api-platform/metadata

API Resource-oriented metadata attributes and factories

223.5M96](/packages/api-platform-metadata)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[flowwow/cloudpayments-php-client

cloudpayments api client

2188.2k](/packages/flowwow-cloudpayments-php-client)

PHPackages © 2026

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