php 有没有办法用 composer 卸载开发依赖项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13744340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to uninstall dev dependencies with composer?
提问by Yohan G.
I want to uninstall (and not remove from my composer.json) dev dependencies on a project.
我想卸载(而不是从我的 composer.json 中删除)对项目的开发依赖项。
Is there a simple way to do this ?
有没有一种简单的方法可以做到这一点?
回答by Seldaek
Running installor updatewith --no-devshould now remove dev requirements and their dependencies.
运行install或update使用--no-dev现在应该删除开发要求及其依赖项。
Original answer for historical purposes:
出于历史目的的原始答案:
Actually no. You can manually rm -rf them from the vendor dir of course, but composer offers no way to uninstall the dev requirements after you did an install with --dev. It's not a huge use case but could warrant a new command line switch, if you would like to report an issue on github.
其实没有。当然,您可以从供应商目录手动 rm -rf 它们,但是在您使用 --dev 进行安装后,composer 无法卸载开发要求。这不是一个巨大的用例,但如果您想在 github 上报告问题,则可能需要一个新的命令行开关。
回答by Koray Güclü
You can use following command after removing the dependencies in composer.jsonfile.
删除composer.json文件中的依赖项后,您可以使用以下命令。
composer update
回答by Blizz
Came over this question when looking for the same answer. You can now uninstall installed dev dependencies by simply doing:
在寻找相同的答案时遇到了这个问题。您现在只需执行以下操作即可卸载已安装的开发依赖项:
composer --no-dev update
It will remove all dev packages that it finds. Though it would interest people landing here the same way I did :)
它将删除它找到的所有开发包。虽然它会让人们以与我相同的方式登陆这里 :)
回答by SandroMarques
This is not the strict answer but may help someone.
这不是严格的答案,但可能会帮助某人。
To remove a specificdev dependency:
要删除特定的开发依赖项:
composer remove --dev squizlabs/php_codesniffer
回答by William Rossier
I answered later but it could help someone else:
composer remove friendsofsymfony/elastica-bundle(for example)
我稍后回答,但它可以帮助其他人:(
composer remove friendsofsymfony/elastica-bundle例如)
Will
将要

