Reputation: 1421
I am using the package teamtnt/laravel-scout-tntsearch-driver
and I wish to make a very small change to one of the files within teamtnt/tntsearch
which is one of the packages dependencies.
Usually I would:
"repositories": [
{"type": "vcs", "url": "https://github.com/user/packagefork"}
],
However, with a dependency which is not directly included in my composer.json file, this does not seem to work. Do I need to fork both the base package, and the dependency package even though I do not need to change anything within the base?
I am hoping there is a simple way to do this, without having to fork each level.
Upvotes: 1
Views: 549
Reputation: 1421
This was actually quite simple. Not too sure why it did not work originally! Instructions below for anyone wondering:
"repositories": [
{"type": "vcs", "url": "https://github.com/youruser/tntsearch"}
],
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
}
This effectively allows you to install your dev-master version, but allow other packages where this is a dependency to request the 2.0 version (in this case). You do need to be careful in this case that you have forked the correct version and any upgrades are correctly managed later down the line, or things may break!
More info on composer alias here
composer require teamtnt/tntsearch:dev-master
The name spacing and package versions will remain the same as before your fork, but the edits from your fork will be pulled into your project instead.
Upvotes: 4