{"id":13803308,"url":"https://github.com/vaimo/composer-patches","last_synced_at":"2025-05-14T13:05:48.426Z","repository":{"id":37927353,"uuid":"52349469","full_name":"vaimo/composer-patches","owner":"vaimo","description":" 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 composer command for testing/troubleshooting patches.","archived":false,"fork":false,"pushed_at":"2025-04-17T11:31:51.000Z","size":1703,"stargazers_count":294,"open_issues_count":41,"forks_count":45,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-04T02:03:08.748Z","etag":null,"topics":["applier","composer","composer-commands","composer-extension","composer-packages","composer-plugin","constraints","maintenance","patch-extension","patcher","patches","patching","plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/vaimo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE_VAIMO.txt","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":"2016-02-23T10:04:04.000Z","updated_at":"2025-05-02T07:44:40.000Z","dependencies_parsed_at":"2023-11-22T16:30:28.541Z","dependency_job_id":"aa06fe24-a9e5-4cee-965c-027ca4878992","html_url":"https://github.com/vaimo/composer-patches","commit_stats":{"total_commits":898,"total_committers":37,"mean_commits":24.27027027027027,"dds":"0.17149220489977723","last_synced_commit":"148ab02bcc073099ded44baf6ff0fefc65d29edd"},"previous_names":[],"tags_count":193,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimo%2Fcomposer-patches","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimo%2Fcomposer-patches/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimo%2Fcomposer-patches/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimo%2Fcomposer-patches/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaimo","download_url":"https://codeload.github.com/vaimo/composer-patches/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253428503,"owners_count":21906930,"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","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":["applier","composer","composer-commands","composer-extension","composer-packages","composer-plugin","constraints","maintenance","patch-extension","patcher","patches","patching","plugin"],"created_at":"2024-08-04T01:00:28.579Z","updated_at":"2025-05-14T13:05:48.398Z","avatar_url":"https://github.com/vaimo.png","language":"PHP","funding_links":[],"categories":["PHP","Plugins"],"sub_categories":["Support"],"readme":"# Vaimo Composer Patches\n\n[![Latest Stable Version](https://poser.pugx.org/vaimo/composer-patches/v/stable)](https://packagist.org/packages/vaimo/composer-patches)\n[![Build Status](https://travis-ci.org/vaimo/composer-patches.svg?branch=master)](https://travis-ci.org/vaimo/composer-patches)\n[![Total Downloads](https://poser.pugx.org/vaimo/composer-patches/downloads)](https://packagist.org/packages/vaimo/composer-patches)\n[![Daily Downloads](https://poser.pugx.org/vaimo/composer-patches/d/daily)](https://packagist.org/packages/vaimo/composer-patches)\n[![Minimum PHP Version](https://img.shields.io/packagist/php-v/vaimo/composer-patches.svg)](https://php.net/)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/vaimo/composer-patches/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/vaimo/composer-patches/?branch=master)\n[![Code Climate](https://codeclimate.com/github/vaimo/composer-patches/badges/gpa.svg)](https://codeclimate.com/github/vaimo/composer-patches)\n\nApplies a patch from a local or remote file to any package that is part of a given composer \nproject. Patches can be defined both on project and on package level in package config or \nseparate JSON file. Declaration-free mode (using embedded info within patch files) is available as well.\n\nThe way the patches are applied (the commands, pre-checks) by the plugin is fully configurable (including the \nactual commands that are executed to apply the patch) from the composer.json of the project.\n\nNote that the plugin is kept on very old PHP version as legacy software is usually the most common context\nwhere patches are needed.\n\n## Full Documentation\n\n* [Basic Usage](./docs/USAGE_BASIC.md) - Defining patches via configuration files or embedded metadata  \n* [Advanced Usage](./docs/USAGE_ADVANCED.md) - Advanced usage options when defining patches\n* [Configuration](./docs/CONFIGURATION.md) - Configuration options for the patch applier\n* [Commands](./docs/COMMANDS.md) - Details on the CLI commands that ship with the plugin\n* [Environment Variables](./docs/ENVIRONMENT.md) - Environment variables to change plugin behavior\n* [Error Handling](./docs/ERRORS.md) - Handling encountered errors\n* [Development](./docs/DEVELOPMENT.md) - Details on the development workflow of the plugin\n* [Examples](./docs/EXAMPLES.md) - Examples on usage of the plugin\n* [Changes](./CHANGELOG.md) - List of changes/fixes per plugin release\n\n## Quick Start\n\nComposer packages can be targeted with patches in two ways: \n\n* Embedded metadata (recommended default approach)\n* JSON declaration and embedded (recommended for remote patches)\n\n### Usage: Embedded Metadata\n\n```json\n{\n  \"require\": {\n    \"some/package-name\": \"1.2.3\"\n  },\n  \"extra\": {\n    \"patcher\": {\n      \"search\": \"patches\"\n    }\n  }\n}\n```\n\nContents of patches/changes.patch:\n\n```diff\nThis patch changes... \nabsolutely everything\n\n@package some/package-name\n\n--- Models/Example.php.org\n+++ Models/Example.php\n@@ -31,7 +31,7 @@\n      */\n     protected function someFunction($someArg)\n     {\n-        $var1 = 123;\n+        $var1 = 456; // patched by composer-patches\n         /**\n          * rest of the logic of the function\n          */\n```\nAs a good practice you might want to add a hint, that the file was patched.\n\nFull list of tag options (that cover all features of the plugin can be found [HERE](./docs/USAGE_BASIC.md#embedded-metadata)).\n\nNote that tags cover most of the features of the module so every explanation given for the json\ndeclaration of the patches applies for tags as well.\n\n### Usage: JSON Declaration\n\n```json\n{\n  \"require\": {\n    \"some/package-name\": \"1.2.3\"\n  },\n  \"extra\": {\n    \"patches\": {\n      \"some/package-name\": {\n        \"This patch changes ... absolutely everything\": \"patches/changes.patch\",\n        \"remote patch\": \"http://www.example.com/remote-patch.patch\",\n        \"remote patch with checksum check\": {\n          \"source\": \"http://www.example.com/other-patch.patch\",\n          \"sha1\": \"5a52eeee822c068ea19f0f56c7518d8a05aef16e\"\n        }\n      }\n    }\n  }\n}\n```\n\nContents of patches/changes.patch:\n\n```diff\n--- Models/Example.php.org\n+++ Models/Example.php\n@@ -31,7 +31,7 @@\n      */\n     protected function someFunction($someArg)\n     {\n-        $var1 = 123;\n+        $var1 = 456;\n         /**\n          * rest of the logic of the function\n          */\n```\n\n### Applier Configuration\n\nThe way patches are applied can be manipulated by changing the configuration of the patcher or by introducing\nadditional patch appliers.\n\nIn most cases there should not be much of a need to reconfigure the module as it does ship with reasonable\ndefaults. The appliers supported by default: patch, git.\n\nMore information on said topic can be found [HERE](./docs/CONFIGURATION.md).\n\n## Upgrades\n\nWhen upgrading the module, one might encounter odd crashes about classes not being found or class \nconstructor arguments being wrong. \n\nThis usually means that the class structure or constructor footprint in some of the classes have changed \nafter the upgrade which means that the plugin might be running with some classes from the old and some \nclasses from the new version. \n\nDue to the fact that the patcher kicks in very late in the process of installing a project (before \nauto-loader generation), developers are advised to re-execute `composer install`.\n\nIdeally, plugins should always be updated with explicit `--no-plugins` flag added to the `composer update`\ncall to avoid issues that plugin usage with potentially mixed logic from two different plugin releases\nbeing in use.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaimo%2Fcomposer-patches","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaimo%2Fcomposer-patches","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaimo%2Fcomposer-patches/lists"}