{"id":14987335,"url":"https://github.com/tattersoftware/codeigniter4-patches","last_synced_at":"2025-09-08T06:38:57.803Z","repository":{"id":43366180,"uuid":"247375559","full_name":"tattersoftware/codeigniter4-patches","owner":"tattersoftware","description":"Automated project updates for CodeIgniter 4","archived":false,"fork":false,"pushed_at":"2025-08-12T04:40:45.000Z","size":220,"stargazers_count":35,"open_issues_count":8,"forks_count":9,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-09-02T15:43:48.155Z","etag":null,"topics":["automatic","codeigniter","codeigniter4","composer","patch","updates"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tattersoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-15T00:31:03.000Z","updated_at":"2025-05-30T08:42:43.000Z","dependencies_parsed_at":"2023-11-07T12:25:21.868Z","dependency_job_id":"f819c1cc-f736-42d6-8784-02a1c891c53e","html_url":"https://github.com/tattersoftware/codeigniter4-patches","commit_stats":{"total_commits":87,"total_committers":7,"mean_commits":"12.428571428571429","dds":"0.14942528735632188","last_synced_commit":"39c07d2ceaaf7eecb41304d1cf2328b9cad563dd"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/tattersoftware/codeigniter4-patches","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-patches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-patches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-patches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-patches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tattersoftware","download_url":"https://codeload.github.com/tattersoftware/codeigniter4-patches/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tattersoftware%2Fcodeigniter4-patches/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274146483,"owners_count":25230115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automatic","codeigniter","codeigniter4","composer","patch","updates"],"created_at":"2024-09-24T14:14:28.142Z","updated_at":"2025-09-08T06:38:57.764Z","avatar_url":"https://github.com/tattersoftware.png","language":"Shell","readme":"# Tatter\\Patches\nAutomated project updates for CodeIgniter 4\n\n[![](https://github.com/tattersoftware/codeigniter4-patches/workflows/Tests/badge.svg)](https://github.com/tattersoftware/codeigniter4-patches/actions/workflows/test.yml)\n\n## Quick Start\n\n1. Install with Composer: `\u003e composer require --dev tatter/patches`\n2. Use the command to update: `\u003e vendor/bin/patch`\n\n## Description\n\n**Patches** helps keep your CodeIgniter 4 projects up-to-date when there are framework changes\nthat affect your project source. Use one easy command to patch your development instance and\nstage any conflicts for easy resolution.\n\n## Requirements\n\n**Patches** is built on top of [Git](https://git-scm.com) and [Composer](https://getcomposer.org),\nso requires both of those be installed and accessible in your `$PATH`. Additionally, the\n`patch` command makes the following assumptions (and will fail if they are not met):\n\n* You project is in an existing Git repository (with configured Git user)\n* The CodeIgniter 4 framework is installed via Composer in your **vendor/** directory\n* The current branch is \"clean\" (no uncommitted changes or unstaged files)\n* Your project files are in their standard locations (**app/**, **public/**, **env**, **spark**)\n* You have no ignored files in **app/** or **public/** that the patch process would disrupt\n* The **vendor/** folder must be ignored for tracking on your Git repository\n\n## Installation\n\nInstall easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities\nand always be up-to-date:\n```console\n\u003e composer require --dev tatter/patches\n```\n\n\u003e Note: While **Patches** can be run in a production environment it is strongly recommended\n  that you install it in development (using `--dev`) and then deploy the repo changes to production.\n\nYou may also download the script and add it to your favorite projects.\n\n## Usage\n\n**Patches** comes with a single script, `patch`, which Composer will treat as a binary and\ndeploy to your **vendor/bin/** folder. Simply run the command to kick off the patch process:\n\n    ./vendor/bin/patch\n\n### Arguments\n\nMost of the time the simple script is what you will want, but `patch` takes a few arguments\nto alter the behavior of the patch process. Arguments that take a \"commit-ish\" can use anything\nGit recognizes (branch, hash, tag, reference, revision, etc).\n\nTo 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.\n\n#### Help (-h)\n\nDisplays the latest command help:\n\n```console\nUsage: ./patch [-c \u003ccurrent version\u003e] [-v \u003ctarget version\u003e]\n\nPatches an existing CodeIgniter 4 project repo to a different version of the framework.\n\nOptions:\n  -h             Help. Show this help message and exit\n  -c commit-ish  Alternate version to consider \"current\" (rarely needed).\n  -v commit-ish  Version to use for patching. Defaults to the latest.\n  -e             Git global user.email.\n  -n             Git global user.name.\n```\n\n#### Version (-v \u003ccommit-ish\u003e)\n\nManually sets the version to patch to. This is useful if you need to stop at a specific\nrelease, or if your project is pointed at the `develop` branch and you do not want certain\ncommits. Examples:\n\n* Patch the current installed repo to a specific version.\n\t./vendor/bin/patch -v 4.1.2\n\n* Patch up to a specific commit.\n\t./vendor/bin/patch -v dev-develop#0cff5488676f36f9e08874fdeea301222b6971a2\n\n#### Current (-c \u003ccommit-ish\u003e)\n\nIgnores the current installed version of the framework in favor of the specified one. This\nis unlikely to be needed in most cases, but can be helpful for example with new installations\nor if you updated with Composer but forgot to run patches first. Example:\n\n* Assume the repo is in an older state and patch.\n\n## How it Works\n\n**Patches** is a shell script that calls `git` and `composer`. When called it will simulate\nan upgrade from your current version of the framework to the latest or specified version.\nThe simulation assumes no files were modified in your project, which is very likely not the\ncase, so the staged simulation is then compared as a three-way merge against your current\nproject root. **Patches** works in a dedicated branch (`tatter/scratch`) so it will never\nmodify your project directly. Patched files are all staged on `tatter/patches` so you can\nreview them before merging or pushing to remote. Consider the following examples.\n\n### Added Files\n\n**CodeIgniter** decides it is time for a `Widget` component, which includes **app/Config/Widget.php**\nfor the configuration. Your project is running version `4.1.2` but wants to update to `4.2.0` to\nuse this new component. When **Patches** simulates the update between these versions `git` will\nnotice the new file:\n\n```console\nA\tapp/Config/Widget.php\n```\n\nWhen the final stage of the patch is run this new file will be merged into your project.\n\n### Changed Files\n\nIn addition to the config file above, `Widget` also comes with a great new `WidgetFilter`. As with\nall `Filters` it must be aliased in your **app/Config/Filters.php** file before it can be used.\nThe framework already took care of this for new projects:\n\n```php\nclass Filters extends BaseConfig\n{\n    /**\n     * Configures aliases for Filter classes to\n     * make reading things nicer and simpler.\n     *\n     * @var array\n     */\n    public $aliases = [\n        'csrf'     =\u003e CSRF::class,\n        'toolbar'  =\u003e DebugToolbar::class,\n        'honeypot' =\u003e Honeypot::class,\n        'widget'   =\u003e WidgetFilter::class,\n    ];\n```\n\nWhen the final stage of the patch is run `git` will examine your existing file at **app/Config/Filters.php**\nand perform its signature [three-way merge](https://en.wikipedia.org/wiki/Merge_(version_control)#Recursive_three-way_merge)\n(technically, this is done with a `cherry-pick`). This means if your version is unchanged or if it has\nbeen modified in a compatible way then **Patches** it will apply the edits for you without intervention.\n\n### Conflicts\n\nCompatible changes are great, but say you have a weird layout fetish (no judgment) and the\n**app/Config/Filters.php** file in your project now looks like this:\n\n```php\nclass Filters extends BaseConfig\n{\n    public $aliases = ['csrf' =\u003e CSRF::class,'toolbar' =\u003e DebugToolbar::class,'honeypot' =\u003e Honeypot::class];\n```\n\nYou likely moral corruption aside, `git` will not know how to handle merging the new `WidgetFilter`\nand you now have a conflict. **Patches** will clean up and leave your repo in the conflict state\nso you can proceed with your favorite conflict resolution. Open **app/Config/Filters.php** in\nyour favorite text editor to find the conflict:\n\n```php\nclass Filters extends BaseConfig\n{\n\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n    public $aliases = ['csrf' =\u003e CSRF::class,'toolbar' =\u003e DebugToolbar::class,'honeypot' =\u003e Honeypot::class];\n=======\n    /**\n     * Configures aliases for Filter classes to\n     * make reading things nicer and simpler.\n     *\n     * @var array\n     */\n    public $aliases = [\n        'csrf'     =\u003e CSRF::class,\n        'toolbar'  =\u003e DebugToolbar::class,\n        'honeypot' =\u003e Honeypot::class,\n        'widget'   =\u003e WidgetFilter::class,\n    ];\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e tatter/scratch\n```\n\nOnce you have resolved all the conflicts you can finish the cherry-pick. For example in this case\nyou would update the file and run the following commands:\n\n```shell\ngit add app/Config/Filters.php\ngit cherry-pick --continue\n```\n\n## Troubleshooting\n\n### Compatibility\n\nIf you are unsure whether **Patches** is compatible with your environment, it is recommended that\nyou run the test cases first. Clone or download the repo and launch the tests with their `run` command:\n\n\t./tests/run\n\n### Clean Up\n\n* It is **always** safe to delete `tatter/scratch` - this branch has nothing relevant to your project.\n* 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.\n* Should you decide not to use **Patches** anymore just remove the Composer package or delete the script - that's all!\n\n### Recovery\n\n**Patches** is very conservative and takes many precautions not to touch any of your project files.\nIf you are relatively new to Git and you get into a merge conflict that becomes a mess, the first\nthing to do: *don't panic*! Your files are safe and your repo is intact and the only thing that can\ncompromise that is typing in a bunch of commands you do not understand from the internet.\n\nThe first thing to know is that **Patches** works with two dedicated branches: `tatter/scratch` is\nwhere it stages all the files, and `tatter/patches` is where it attempts the merge. If you are stuck\nmake sure you know which branch you are on using `git branch` - likely your project uses one of the\ntypical \"main\" branches: `develop`, `main`, or `master`.\n\nNext thing to be aware of, the final merge stage that could induce conflict is actually handled by\na `cherry-pick`. This is a technical Git process for isolating a single commit and applying it to\nanother branch. if you are mid-cherry-pick then `git status` should display the current state, as well\nas any conflicting files and some hints for how to proceed:\n\n```console\ngit status\nOn branch tatter/patches\nYou are currently cherry-picking commit a8b4361.\n  (all conflicts fixed: run \"git cherry-pick --continue\")\n  (use \"git cherry-pick --skip\" to skip this patch)\n  (use \"git cherry-pick --abort\" to cancel the cherry-pick operation)\n```\n\nAs hinted above, you should be able to abort the entire process and get back to your unaltered\nproject state any time you like with the following commands (swap `develop` for your main branch name):\n* `git cherry-pick --abort`\n* `git switch develop`\n\n### Support\n\nStill need help?\n\n* Visit the [CodeIgniter Forums](https://forum.codeigniter.com/) to ask for help.\n* Click the \"Sponsor\" button on [the Patches repo](https://github.com/tattersoftware/codeigniter4-patches) for premium support options\n\n**GitHub Issues are for Bug Reports and Feature Requests only. Issues opened for support will be\nclosed and their authors browbeaten.**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Fcodeigniter4-patches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftattersoftware%2Fcodeigniter4-patches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftattersoftware%2Fcodeigniter4-patches/lists"}