{"id":34044550,"url":"https://github.com/sidworks-dev/composer-patcher","last_synced_at":"2025-12-16T11:51:33.001Z","repository":{"id":328180120,"uuid":"1114519454","full_name":"sidworks-dev/composer-patcher","owner":"sidworks-dev","description":"Composer plugin to automatically apply patches to vendor packages, no forking required. Supports dev-only patches and interactive patch creation.","archived":false,"fork":false,"pushed_at":"2025-12-12T15:43:54.000Z","size":24,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-12T17:30:34.738Z","etag":null,"topics":["composer","composer-patch","composer-plugin","git-patch","patch","patching","php","vendor-patches"],"latest_commit_sha":null,"homepage":"https://www.sidworks.nl","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/sidworks-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-11T13:43:53.000Z","updated_at":"2025-12-12T15:43:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sidworks-dev/composer-patcher","commit_stats":null,"previous_names":["sidworks-dev/composer-patcher"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/sidworks-dev/composer-patcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidworks-dev%2Fcomposer-patcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidworks-dev%2Fcomposer-patcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidworks-dev%2Fcomposer-patcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidworks-dev%2Fcomposer-patcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidworks-dev","download_url":"https://codeload.github.com/sidworks-dev/composer-patcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidworks-dev%2Fcomposer-patcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27763657,"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-12-16T02:00:10.477Z","response_time":57,"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":["composer","composer-patch","composer-plugin","git-patch","patch","patching","php","vendor-patches"],"created_at":"2025-12-13T23:00:44.014Z","updated_at":"2025-12-16T11:51:32.992Z","avatar_url":"https://github.com/sidworks-dev.png","language":"PHP","funding_links":[],"categories":["Plugins"],"sub_categories":["Developer Experience"],"readme":"# Sidworks Composer Patcher\n\n[![Latest Version](https://img.shields.io/packagist/v/sidworks/composer-patcher.svg)](https://packagist.org/packages/sidworks/composer-patcher)\n[![PHP Version](https://img.shields.io/packagist/php-v/sidworks/composer-patcher.svg)](https://packagist.org/packages/sidworks/composer-patcher)\n[![License](https://img.shields.io/packagist/l/sidworks/composer-patcher.svg)](LICENSE)\n\nA Composer plugin that automatically applies git-format patches to your project. Useful for patching vendor packages without forking.\n\n## Features\n\n- **Automatic patching** - Patches are applied after every `composer install` and `composer update`\n- **Development patches** - Use `.patch.dev` files for patches that only apply in dev mode\n- **Organized structure** - Supports subdirectories to organize patches by package\n- **Idempotent** - Safely re-applies patches on every run (reverses first, then applies)\n- **Whitespace tolerant** - Ignores whitespace differences when applying patches\n- **Interactive patch creation** - Generate patches from modified vendor files with a single command\n- **Clear reporting** - Grouped output showing success/failure status for all patches\n\n## Installation\n\n```bash\ncomposer require sidworks/composer-patcher\n```\n\n## Quick Start\n\n1. Create a `patches` directory in your project root\n2. Add `.patch` files (git diff format)\n3. Run `composer install`\n\n## Directory Structure\n\n```\nyour-project/\n├── composer.json\n├── patches/\n│   ├── fix-typo.patch              # Applied always\n│   ├── debug-helper.patch.dev      # Applied only in dev mode\n│   └── acme/                       # Organize by package\n│       └── utils/\n│           └── fix-calculation.patch\n└── vendor/\n```\n\n## Creating Patches\n\n### Using the Built-in Command\n\nThe easiest way to create a patch from a modified vendor file:\n\n```bash\ncomposer sidworks:composer-patcher --create\n```\n\nThis interactive command will:\n1. Ask for the file path (e.g., `vendor/acme/utils/src/Calculator.php`)\n2. Extract the original file from the package\n3. Generate a diff between original and modified versions\n4. Ask if you want to save in the package folder (e.g., `patches/acme/utils/`)\n5. Save the patch with your chosen filename\n\nExample session:\n```\nEnter the file path (relative to project root):\n\u003e vendor/acme/utils/src/Calculator.php\n\nSave in patches/acme/utils/? [Y/n] y\n\nEnter patch filename [Calculator.php.patch]:\n\u003e\n\n✓ Patch created successfully!\nLocation: patches/acme/utils/Calculator.php.patch\n```\n\n### Manually Creating Patches\n\nGenerate a patch using git diff:\n\n```bash\n# For tracked files\ngit diff vendor/package/file.php \u003e patches/my-fix.patch\n\n# Or from scratch using diff\ndiff -u original.php modified.php \u003e patches/my-fix.patch\n```\n\nPatches must use git-style headers:\n\n```diff\n--- a/vendor/package/src/File.php\n+++ b/vendor/package/src/File.php\n@@ -10,7 +10,7 @@\n     public function example()\n     {\n-        return 'old';\n+        return 'new';\n     }\n```\n\n## Patch Types\n\n| Extension | Applied When |\n|-----------|--------------|\n| `.patch` | Always (install and update) |\n| `.patch.dev` | Only in dev mode (`composer install` without `--no-dev`) |\n\n## Commands\n\n### Apply Patches Manually\n\n```bash\ncomposer sidworks:composer-patcher\n```\n\nRuns the patcher manually (useful for testing). Always runs in dev mode.\n\n### Create a Patch\n\n```bash\ncomposer sidworks:composer-patcher --create\n# or\ncomposer sidworks:composer-patcher -c\n```\n\n## How It Works\n\n1. On `composer install` or `composer update`, the plugin activates\n2. All existing patches are reversed (to handle updates cleanly)\n3. Patches are re-applied in alphabetical order\n4. Results are displayed grouped by folder\n5. If any patch fails, Composer exits with error code 1\n\n## Requirements\n\n- PHP 8.0+\n- Composer 2.x\n- Git (for applying patches)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidworks-dev%2Fcomposer-patcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidworks-dev%2Fcomposer-patcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidworks-dev%2Fcomposer-patcher/lists"}