问题
I know it's possible to override a composer dependency using:
"some/module": "1.0.0 as 2.0.0",
But is it possible to entirely remove a dependency that one of my dependencies requires?
The issue is that I am requiring "cwp/cwp-recipe-basic": "1.1.0",
which can be found here. That package is simply another list of dependencies, however I do not want one of those dependencies.
Is there any way of telling composer to ignore that one dependency?
E.g.
"cwp/cwp-recipe-basic": "1.1.0",
"silverstripe/fulltextsearch": " as 1.1.0"
回答1:
I guess you can't. But if it is only a list of dependencies why don't you just copy the list except the ones you don't need and paste them into your composer.json
?
Another approach could be if it is a long list to fork cwp/cwp-recipe-basic
and remove the dependencies you don't need from that list and then require the fork in your project.
回答2:
You can use replace setting in your composer.json
:
"replace": {
"silverstripe/fulltextsearch": "1.1.0"
}
Composer will act as this package is already available and will not install it. Note that you will not able to use it, since it is not actually installed.
来源:https://stackoverflow.com/questions/30859285/can-i-override-a-composer-json-dependency-to-remove-it