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

ActiveComposer-plugin

lexisother/composer-patches-regex
=================================

1.1.1(5mo ago)0838↓33.3%1AGPL-3.0-or-laterPHPPHP &gt;=8.0.0

Since Nov 21Pushed 5mo ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (5)Used By (1)

composer-patches-regex
======================

[](#composer-patches-regex)

A Composer plugin that allows for regex replacements patches using [composer-patches](https://github.com/cweagans/composer-patches).

Requirements
------------

[](#requirements)

- PHP 8.0.0 or higher
- `cweagans/composer-patches`, preferably on commit `5269693119b245e273db052f12ab23d74aca26fc` or later.
    - (note: this *has* to be installed through either `dev-main` or a custom `repositories` entry, as this package version isn't tagged on Packagist)

First of all, install the package using `composer require lexisother/composer-patches-regex`.

You should be prompted to allow the plugin to run code, if not, add the following to your `composer.json`:

```
{
  // ...
  "config": {
    "allow-plugins": {
      // ...
      "lexisother/composer-patches-regex": true
    }
  }
}
```

Defining patches
----------------

[](#defining-patches)

A patch looks simple. For the most part they are like regular `composer-patches` entries. You can read more about the general definition of patches [here](https://docs.cweagans.net/composer-patches/usage/defining-patches).

It is important to note that this plugin only supports patches defined with the *expanded format*.

Let's define a simple patch for a package with the following file in its *root directory* (`vendor/scope/packagename`):

```
I am some original text. I love being original.

```

We want to change the word "some" to "a bit of" and all instances of "original" to "copied". Our patch for this would look as follows:

```
{
  // ...
  "extra": {
    "patches": {
      "scope/packagename": [
        {
          "description": "A simple description of your patch here",
          "url": "./.gitignore",
          "extra": {
            "regex": {
              "files": {
                "someFile": [
                  {
                    "find": "/some/",
                    "replace": "a bit of"
                  },
                  {
                    "find": "/original/g",
                    "replace": "copied"
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}
```

Note

When using the `extra.regex.files` key, please set the patch `url` to some arbitrary local file. `composer-patches`requires there to be a `url`, but we don't use it.

After running `composer patches-relock` and `composer patches-repatch`, `vendor/scope/packagename/someFile` would now look like this:

```
I am a bit of copied text. I love being copied.

```

Options
-------

[](#options)

The plugin exposes some options to change the behaviour of the patcher. All of these options should be set directly inside `extra.regex`.

### `fromUrl`

[](#fromurl)

Setting this option to `true` makes the plugin ignore the `files` key and instead download the JSON from the specified URL. So if you are migrating your local patches to a file that is hosted remotely, please set your patch's `url` field to a valid URL pointing to your file.

### `ignoreErrors`

[](#ignoreerrors)

Setting this option to `true` prevents `composer-patches` from failing with `"No available patcher was able to apply patch"` if any of your patches contain errors.

License
=======

[](#license)

This project is dual-licensed under the [Commons Clause](https://commonsclause.com/) and the [GNU AGPL](https://choosealicense.com/licenses/agpl-3.0/).

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance73

Regular maintenance activity

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

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

Total

4

Last Release

152d ago

### Community

Maintainers

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

---

Top Contributors

[![lexisother](https://avatars.githubusercontent.com/u/54973868?v=4)](https://github.com/lexisother "lexisother (9 commits)")

---

Tags

composercomposer-patchescomposer-pluginphp

### Embed Badge

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

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

###  Alternatives

[humbug/box

Fast, zero config application bundler with PHARs.

1.3k801.5k69](/packages/humbug-box)[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)[mglaman/composer-drupal-lenient

1317.4M15](/packages/mglaman-composer-drupal-lenient)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5341.9M446](/packages/drupal-core-composer-scaffold)[roots/wordpress-core-installer

A Composer custom installer to handle installing WordPress as a dependency

4115.6M19](/packages/roots-wordpress-core-installer)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)

PHPackages © 2026

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