{"id":13803300,"url":"https://github.com/netresearch/composer-patches-plugin","last_synced_at":"2025-05-16T07:03:56.305Z","repository":{"id":13429118,"uuid":"16117907","full_name":"netresearch/composer-patches-plugin","owner":"netresearch","description":"Plugin for composer to apply patches onto dependencies.","archived":false,"fork":false,"pushed_at":"2025-02-19T12:58:17.000Z","size":94,"stargazers_count":79,"open_issues_count":3,"forks_count":22,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-09T21:11:02.702Z","etag":null,"topics":["composer","composer-plugin","patches"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netresearch.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":"2014-01-21T20:27:08.000Z","updated_at":"2025-02-19T12:57:12.000Z","dependencies_parsed_at":"2025-03-11T11:10:30.103Z","dependency_job_id":"dd455c17-07eb-4f14-ba30-e350711eae9a","html_url":"https://github.com/netresearch/composer-patches-plugin","commit_stats":{"total_commits":53,"total_committers":13,"mean_commits":4.076923076923077,"dds":0.7547169811320755,"last_synced_commit":"5c5ce22e7b07d93376c8e363e53eeeee964ee24a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Fcomposer-patches-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Fcomposer-patches-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Fcomposer-patches-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netresearch%2Fcomposer-patches-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netresearch","download_url":"https://codeload.github.com/netresearch/composer-patches-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485053,"owners_count":22078767,"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":["composer","composer-plugin","patches"],"created_at":"2024-08-04T01:00:28.099Z","updated_at":"2025-05-16T07:03:56.285Z","avatar_url":"https://github.com/netresearch.png","language":"PHP","funding_links":[],"categories":["Plugins"],"sub_categories":["Support"],"readme":"# composer-patches-plugin\n\nThis plugin allows you to provide patches for any package from any package.\n\nIf you don't want a patch package outside the root package, consider providing it as package in the [repositories key](https://getcomposer.org/doc/04-schema.md#repositories)\n\n```json\n{\n    \"name\": \"vendor/package\",\n    \"type\": \"project\",\n    \"repositories\": [\n        {\n            \"type\": \"package\",\n            \"package\": {\n                \"type\": \"metapackage\",\n                \"name\": \"vendor/package-patches\",\n                \"version\": \"1.0.0\",\n                \"require\": {\n                    \"netresearch/composer-patches-plugin\": \"~1.0\"\n                },\n                \"extra\": {\n                    \"patches\": {\n                        \"vendor/name\": [\n                            {\n                                \"url\": \"https://my-domain.com/path/to/my.patch\"\n                            }\n                        ]\n                    }\n                }\n            }\n        }\n    ],\n    \"require\": {\n        \"vendor/package-patches\": \"~1.0\"\n    }\n}\n```\n\nSee this presentation for the original idea of this plugin: http://de.slideshare.net/christianopitz/distributed-patching-with-composer\n\n## Patch properties\n\nKey | Description | Required\n--- | --- | ---\n``url`` | The url or path to the patch | ✓\n``title`` | Title to display when applying or reverting the patch |\n``args`` | string, which will be added to the patch command |\n``sha1`` | SHA1 checksum of the patch contents for security check - when given the patches actual checksum and this value are compared and if they don't match an exception will be thrown |\n\nYou may provide patches per package and optionally by version constraints:\n\n## Provide patches by package only\n```json\n{\n    \"name\": \"netresearch/typo3-patches\",\n    \"version\": \"1.0.0\",\n    \"type\": \"metapackage\",\n    \"require\": {\n        \"netresearch/composer-patches-plugin\": \"~1.0\"\n    },\n    \"extra\": {\n        \"patches\": {\n            \"typo3/cms\": [\n                {\n                    \"title\": \"[FEATURE] Allow registration of different login forms\",\n                    \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539\"\n                },\n                {\n                    \"title\": \"[PATCH] [BUGFIX] Flexform \\\"required\\\" on input fields applies to last field only\",\n                    \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786\"\n                }\n            ]\n        }\n    }\n}\n```\n\n## Provide patches by package and versions or version constraints\n\n***\ncomposer.json:\n```json\n{\n    \"name\": \"netresearch/typo3-patches\",\n    \"version\": \"1.0.0\",\n    \"type\": \"metapackage\",\n    \"require\": {\n        \"netresearch/composer-patches-plugin\": \"~1.0\"\n    },\n    \"extra\": {\n        \"patches\": {\n            \"typo3/cms\":     {\n                \"6.2.0-beta1\": [\n                    {\n                        \"title\": \"[FEATURE] Allow registration of different login forms\",\n                        \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539\"\n                    },\n                    {\n                        \"title\": \"[PATCH] [BUGFIX] Flexform \\\"required\\\" on input fields applies to last field only\",\n                        \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786\"\n                    }\n                ],\n                \"6.2.0-beta2\": [\n                    {\n                        \"title\": \"[PATCH] [BUGFIX] Flexform \\\"required\\\" on input fields applies to last field only\",\n                        \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786\"\n                    }\n                ],\n                \"6.2.*\": [\n                    {\n                        \"title\": \"[BUGFIX] Ignore dependencies on non typo3-cms-extension\",\n                        \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/9fe856ac96e6a53fef8277f36a4a80bace6f0ae9\",\n                        \"sha1\": \"b56a1c47a67d1596c0bd8270e61c44f8911af425\"\n                    }\n                ]\n            }\n        }\n    }\n}\n```\n\n**Note**: *When multiple version constraints match the version of the target package, all of the matching patches will be applied (canonicalized by theyr checksums, so no duplicates should occure).*\n\n## Provide patches from URLs or paths\n\nYou can put any part of the patches object into another JSON and load it via an URL (or a path):\n\ncomposer.json:\n```json\n{\n    \"name\": \"netresearch/typo3-patches\",\n    \"version\": \"1.0.0\",\n    \"type\": \"metapackage\",\n    \"require\": {\n        \"netresearch/composer-patches-plugin\": \"~1.0\"\n    },\n    \"extra\": {\n        \"patches\": {\n            \"typo3/cms\": \"http://example.com/typo3-patches.json\"\n        }\n    }\n}\n```\n\nhttp://example.com/typo3-patches.json\n```json\n{\n    \"6.2.0-beta1\": [\n        {\n            \"title\": \"[FEATURE] Allow registration of different login forms\",\n            \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/32f331fead9c7aa50d9248c54e3c0af75d793539\"\n        },\n        {\n            \"title\": \"[PATCH] [BUGFIX] Flexform \\\"required\\\" on input fields applies to last field only\",\n            \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786\"\n        }\n    ],\n    \"6.2.0-beta2\": [\n        {\n            \"title\": \"[PATCH] [BUGFIX] Flexform \\\"required\\\" on input fields applies to last field only\",\n            \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/a48f8b0dae11ce7246eff43132d986bccf55b786\"\n        }\n    ],\n    \"6.2.*\": [\n        {\n            \"title\": \"[BUGFIX] Ignore dependencies on non typo3-cms-extension\",\n            \"url\": \"https://git.typo3.org/Packages/TYPO3.CMS.git/patch/9fe856ac96e6a53fef8277f36a4a80bace6f0ae9\",\n            \"sha1\": \"b56a1c47a67d1596c0bd8270e61c44f8911af425\"\n        }\n    ]\n}\n```\n\n## Provide patches from local stored files\nYou can use absolute paths or paths relative to the application root.\n\ncomposer.json:\n```json\n\"repositories\": [\n        {\n            \"type\": \"package\",\n            \"package\": {\n                \"type\": \"metapackage\",\n                \"name\": \"vendor/package-patches\",\n                \"version\": \"1.0.0\",\n                \"require\": {\n                    \"netresearch/composer-patches-plugin\": \"~1.0\"\n                },\n                \"extra\": {\n                    \"patches\": {\n                        \"typo3/cms\":     [\n                            {\n                                    \"title\": \"[FEATURE] Allow registration of different login forms\",\n                                    \"url\": \"patches/example_local_file.patch\"\n                            }\n                        ]\n                    }\n                }\n            }\n        }\n    ],\n   \"require\": {\n        ....\n    },\n```\nI have also added a new folder at the same level as the composer.json called \"patches\" and add a patch file example_local_file.patch like:\n\n```\n# This patch file was generated by NetBeans IDE\n# It uses platform neutral UTF-8 encoding and \\n newlines.\n--- a/src/com/zoho/crm/library/exception/Logger.php\n+++ b/src/com/zoho/crm/library/exception/Logger.php\n@@ -6,7 +6,7 @@\n \t{\n \t\tset_include_path(ZCRMConfigUtil::getConfigValue('applicationLogFilePath'));\n \t\t$path=get_include_path();\n-\t\tif($path{strlen($path)-1}!='\\/')\n+\t\tif($path[strlen($path)-1]!='\\/')\n \t\t{\n \t\t\t$path=$path.\"/\";\n \t\t}\n\n\n```\n\n*Note* that the patch will be called with the option -p1 (remove the first slash) and in the directory of the library.\n\nThen run the commands to update the dependency and to install patches:\n```\ncomposer update vendor/package-patches\ncomposer install\n```\n    \n## Requiring the patches:\njust require the package with the patches.\n\n```json\n{\n    \"name\": \"netresearch/patched-typo3\",\n    \"type\": \"project\",\n    \"description\": \"A patched version of typo3\",\n    \"minimum-stability\": \"dev\",\n    \"require\": {\n        \"netresearch/typo3-patches\": \"~1.0\",\n        \"typo3/cms\": \"6.2.0-beta3\"\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetresearch%2Fcomposer-patches-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetresearch%2Fcomposer-patches-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetresearch%2Fcomposer-patches-plugin/lists"}