https://github.com/rectorphp/vendor-patches
Vendor patches for Rector packages
https://github.com/rectorphp/vendor-patches
composer rector
Last synced: 7 months ago
JSON representation
Vendor patches for Rector packages
- Host: GitHub
- URL: https://github.com/rectorphp/vendor-patches
- Owner: rectorphp
- Created: 2021-12-03T18:08:00.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-19T20:10:31.000Z (8 months ago)
- Last Synced: 2025-05-31T00:52:00.644Z (8 months ago)
- Topics: composer, rector
- Homepage:
- Size: 38.1 KB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vendor Patches
Shared patches for Rector packages, for easier re-use.
This meta package makes use of [cweagans/composer-patches](https://github.com/cweagans/composer-patches).
## How to Use
The composer patches packages does not work as intuitively as you may expect. Yet, there is a combination, that clicks :)
### ~~1. External File~~
The [external patch file](https://github.com/cweagans/composer-patches#using-an-external-patch-file) works only for main `rector/rector-src` repository. It cannot be used e.g. for dev packages that depend on `rector/rector-src
:red_circle:
### 2. Define Patch Paths in `rector/rector-src`
The patches must be defined in [`rector/rector-src` in `composer.json`](https://github.com/rectorphp/rector-src/blob/0dd833b1e29ba665bbb3acad85a6359f701f2e18/composer.json#L154-L164):
```json
{
"extra": {
"patches": {
"package-name": [
"https://raw.github.com/.../patches/some.patch"
]
}
}
}
```
* The path to patch **file must be absolute**. Relative path fails when using `rector/rector-src` as dependency, as the `composer.json` is nested there
### 3. Add Patch File Here
The patch must be added to this repository in `/patches` directory.
### 4. Allow Patches in Dependent Package
The dependency package (e.g. [rector/rector-symfony](https://github.com/rectorphp/rector-symfony)) must allow to install patches from `rector/rector-src` in the package `composer.json`:
```json
{
"require-dev": {
"symplify/vendor-patches": "^10.0"
},
"extra": {
"enable-patching": true
}
}
```
It also must require `symplify/vendor-patches package`, to invoke the plugin on `composer install`.
This is the setup that works :heavy_check_mark: