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

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

tatter/patches
==============

Automated project updates for CodeIgniter 4

v2.1.0(2y ago)3588.4k↑46.3%9[2 issues](https://github.com/tattersoftware/codeigniter4-patches/issues)[3 PRs](https://github.com/tattersoftware/codeigniter4-patches/pulls)3MITShellPHP ^7.3 || ^8.0CI passing

Since May 30Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/tattersoftware/codeigniter4-patches)[ Packagist](https://packagist.org/packages/tatter/patches)[ Docs](https://github.com/tattersoftware/codeigniter4-patches)[ Fund](https://paypal.me/tatter)[ GitHub Sponsors](https://github.com/tattersoftware)[ RSS](/packages/tatter-patches/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)DependenciesVersions (16)Used By (3)

Tatter\\Patches
===============

[](#tatterpatches)

Automated project updates for CodeIgniter 4

[![](https://github.com/tattersoftware/codeigniter4-patches/workflows/Tests/badge.svg)](https://github.com/tattersoftware/codeigniter4-patches/actions/workflows/test.yml)

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

[](#quick-start)

1. Install with Composer: `> composer require --dev tatter/patches`
2. Use the command to update: `> vendor/bin/patch`

Description
-----------

[](#description)

**Patches** helps keep your CodeIgniter 4 projects up-to-date when there are framework changes that affect your project source. Use one easy command to patch your development instance and stage any conflicts for easy resolution.

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

[](#requirements)

**Patches** is built on top of [Git](https://git-scm.com) and [Composer](https://getcomposer.org), so requires both of those be installed and accessible in your `$PATH`. Additionally, the `patch` command makes the following assumptions (and will fail if they are not met):

- You project is in an existing Git repository (with configured Git user)
- The CodeIgniter 4 framework is installed via Composer in your **vendor/** directory
- The current branch is "clean" (no uncommitted changes or unstaged files)
- Your project files are in their standard locations (**app/**, **public/**, **env**, **spark**)
- You have no ignored files in **app/** or **public/** that the patch process would disrupt
- The **vendor/** folder must be ignored for tracking on your Git repository

Installation
------------

[](#installation)

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

```
> composer require --dev tatter/patches
```

> Note: While **Patches** can be run in a production environment it is strongly recommended that you install it in development (using `--dev`) and then deploy the repo changes to production.

You may also download the script and add it to your favorite projects.

Usage
-----

[](#usage)

**Patches** comes with a single script, `patch`, which Composer will treat as a binary and deploy to your **vendor/bin/** folder. Simply run the command to kick off the patch process:

```
./vendor/bin/patch

```

### Arguments

[](#arguments)

Most of the time the simple script is what you will want, but `patch` takes a few arguments to alter the behavior of the patch process. Arguments that take a "commit-ish" can use anything Git recognizes (branch, hash, tag, reference, revision, etc).

To ensure patches work correctly in a Docker container, you may need to set the `user.email` and `user.name` values manually using the `-e` and `-n` flags respectively. This is necessary because Docker containers are often not preconfigured for Git.

#### Help (-h)

[](#help--h)

Displays the latest command help:

```
Usage: ./patch [-c ] [-v ]

Patches an existing CodeIgniter 4 project repo to a different version of the framework.

Options:
  -h             Help. Show this help message and exit
  -c commit-ish  Alternate version to consider "current" (rarely needed).
  -v commit-ish  Version to use for patching. Defaults to the latest.
  -e             Git global user.email.
  -n             Git global user.name.
```

#### Version (-v )

[](#version--v-)

Manually sets the version to patch to. This is useful if you need to stop at a specific release, or if your project is pointed at the `develop` branch and you do not want certain commits. Examples:

- Patch the current installed repo to a specific version. ./vendor/bin/patch -v 4.1.2
- Patch up to a specific commit. ./vendor/bin/patch -v dev-develop#0cff5488676f36f9e08874fdeea301222b6971a2

#### Current (-c )

[](#current--c-)

Ignores the current installed version of the framework in favor of the specified one. This is unlikely to be needed in most cases, but can be helpful for example with new installations or if you updated with Composer but forgot to run patches first. Example:

- Assume the repo is in an older state and patch.

How it Works
------------

[](#how-it-works)

**Patches** is a shell script that calls `git` and `composer`. When called it will simulate an upgrade from your current version of the framework to the latest or specified version. The simulation assumes no files were modified in your project, which is very likely not the case, so the staged simulation is then compared as a three-way merge against your current project root. **Patches** works in a dedicated branch (`tatter/scratch`) so it will never modify your project directly. Patched files are all staged on `tatter/patches` so you can review them before merging or pushing to remote. Consider the following examples.

### Added Files

[](#added-files)

**CodeIgniter** decides it is time for a `Widget` component, which includes **app/Config/Widget.php**for the configuration. Your project is running version `4.1.2` but wants to update to `4.2.0` to use this new component. When **Patches** simulates the update between these versions `git` will notice the new file:

```
A	app/Config/Widget.php
```

When the final stage of the patch is run this new file will be merged into your project.

### Changed Files

[](#changed-files)

In addition to the config file above, `Widget` also comes with a great new `WidgetFilter`. As with all `Filters` it must be aliased in your **app/Config/Filters.php** file before it can be used. The framework already took care of this for new projects:

```
class Filters extends BaseConfig
{
    /**
     * Configures aliases for Filter classes to
     * make reading things nicer and simpler.
     *
     * @var array
     */
    public $aliases = [
        'csrf'     => CSRF::class,
        'toolbar'  => DebugToolbar::class,
        'honeypot' => Honeypot::class,
        'widget'   => WidgetFilter::class,
    ];
```

When the final stage of the patch is run `git` will examine your existing file at **app/Config/Filters.php**and perform its signature [three-way merge](https://en.wikipedia.org/wiki/Merge_(version_control)#Recursive_three-way_merge)(technically, this is done with a `cherry-pick`). This means if your version is unchanged or if it has been modified in a compatible way then **Patches** it will apply the edits for you without intervention.

### Conflicts

[](#conflicts)

Compatible changes are great, but say you have a weird layout fetish (no judgment) and the **app/Config/Filters.php** file in your project now looks like this:

```
class Filters extends BaseConfig
{
    public $aliases = ['csrf' => CSRF::class,'toolbar' => DebugToolbar::class,'honeypot' => Honeypot::class];
```

You likely moral corruption aside, `git` will not know how to handle merging the new `WidgetFilter`and you now have a conflict. **Patches** will clean up and leave your repo in the conflict state so you can proceed with your favorite conflict resolution. Open **app/Config/Filters.php** in your favorite text editor to find the conflict:

```
class Filters extends BaseConfig
{
 DebugToolbar::class,'honeypot' => Honeypot::class];
=======
    /**
     * Configures aliases for Filter classes to
     * make reading things nicer and simpler.
     *
     * @var array
     */
    public $aliases = [
        'csrf'     => CSRF::class,
        'toolbar'  => DebugToolbar::class,
        'honeypot' => Honeypot::class,
        'widget'   => WidgetFilter::class,
    ];
>>>>>>> tatter/scratch
```

Once you have resolved all the conflicts you can finish the cherry-pick. For example in this case you would update the file and run the following commands:

```
git add app/Config/Filters.php
git cherry-pick --continue
```

Troubleshooting
---------------

[](#troubleshooting)

### Compatibility

[](#compatibility)

If you are unsure whether **Patches** is compatible with your environment, it is recommended that you run the test cases first. Clone or download the repo and launch the tests with their `run` command:

```
./tests/run

```

### Clean Up

[](#clean-up)

- It is **always** safe to delete `tatter/scratch` - this branch has nothing relevant to your project.
- It is **always** safe to delete `tatter/patches`, but if you have not committed and merged the changes then you will need to start the patch process over.
- Should you decide not to use **Patches** anymore just remove the Composer package or delete the script - that's all!

### Recovery

[](#recovery)

**Patches** is very conservative and takes many precautions not to touch any of your project files. If you are relatively new to Git and you get into a merge conflict that becomes a mess, the first thing to do: *don't panic*! Your files are safe and your repo is intact and the only thing that can compromise that is typing in a bunch of commands you do not understand from the internet.

The first thing to know is that **Patches** works with two dedicated branches: `tatter/scratch` is where it stages all the files, and `tatter/patches` is where it attempts the merge. If you are stuck make sure you know which branch you are on using `git branch` - likely your project uses one of the typical "main" branches: `develop`, `main`, or `master`.

Next thing to be aware of, the final merge stage that could induce conflict is actually handled by a `cherry-pick`. This is a technical Git process for isolating a single commit and applying it to another branch. if you are mid-cherry-pick then `git status` should display the current state, as well as any conflicting files and some hints for how to proceed:

```
git status
On branch tatter/patches
You are currently cherry-picking commit a8b4361.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)
```

As hinted above, you should be able to abort the entire process and get back to your unaltered project state any time you like with the following commands (swap `develop` for your main branch name):

- `git cherry-pick --abort`
- `git switch develop`

### Support

[](#support)

Still need help?

- Visit the [CodeIgniter Forums](https://forum.codeigniter.com/) to ask for help.
- Click the "Sponsor" button on [the Patches repo](https://github.com/tattersoftware/codeigniter4-patches) for premium support options

**GitHub Issues are for Bug Reports and Feature Requests only. Issues opened for support will be closed and their authors browbeaten.**

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance46

Moderate activity, may be stable

Popularity43

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 88.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 ~101 days

Recently: every ~209 days

Total

13

Last Release

965d ago

Major Versions

v1.2.0 → v2.0.02021-06-10

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

v2.0.0PHP ^7.3 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![MGatner](https://avatars.githubusercontent.com/u/17572847?v=4)](https://github.com/MGatner "MGatner (97 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![jozefrebjak](https://avatars.githubusercontent.com/u/36922215?v=4)](https://github.com/jozefrebjak "jozefrebjak (3 commits)")[![whoisninjaturtle](https://avatars.githubusercontent.com/u/63665689?v=4)](https://github.com/whoisninjaturtle "whoisninjaturtle (2 commits)")[![gitchak](https://avatars.githubusercontent.com/u/15377896?v=4)](https://github.com/gitchak "gitchak (1 commits)")[![kenjis](https://avatars.githubusercontent.com/u/87955?v=4)](https://github.com/kenjis "kenjis (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

automaticcodeignitercodeigniter4composerpatchupdatescodeigniterautomaticupdatecodeigniter4patchesautoupdate

### Embed Badge

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

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

###  Alternatives

[codeigniter4/settings

Settings library for CodeIgniter 4

93499.3k24](/packages/codeigniter4-settings)[codeigniter4/devkit

Development toolkit for CodeIgniter libraries and projects

68187.1k82](/packages/codeigniter4-devkit)[tatter/alerts

Lightweight user alerts for CodeIgniter 4

4072.4k6](/packages/tatter-alerts)[michalsn/codeigniter4-uuid

UUID and ULID package for CodeIgniter 4 with support for Model.

4728.7k4](/packages/michalsn-codeigniter4-uuid)[kenjis/ci3-to-4-upgrade-helper

Help upgrade from CodeIgniter3 to CodeIgniter4

695.9k](/packages/kenjis-ci3-to-4-upgrade-helper)[tatter/visits

Lightweight traffic tracking for CodeIgniter 4

338.6k2](/packages/tatter-visits)

PHPackages © 2026

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