php 如何从 Composer 全局删除一个包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19217477/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 19:02:15  来源:igfitidea点击:

How to remove globally a package from Composer?

phpcomposer-phpcommand-line-interface

提问by winkster

I ran this command to install globally PHPUnit:

我运行这个命令来全局安装PHPUnit

composer global require 'phpunit/phpunit=3.7.*'

Now I want to uninstall globally PHPUnit.

现在我想全局卸载PHPUnit

Any ideas?

有任何想法吗?

回答by Jakub Zalas

To remove a globally installed package run:

要删除全局安装的软件包,请运行:

composer global remove phpunit/phpunit

globalcommand lets you to run many commands like install, requireor updateas if you were running them from the COMPOSER_HOMEdirectory.

globalcommand 允许您运行许多命令,例如installrequire或者update就好像您是从COMPOSER_HOME目录中运行它们一样。

Read the related documentation here: http://getcomposer.org/doc/03-cli.md#global

在此处阅读相关文档:http: //getcomposer.org/doc/03-cli.md#global

COMPOSER_HOMEdepends on your system (on Linux it's ~/.composer), see http://getcomposer.org/doc/03-cli.md#composer-homefor more details.

COMPOSER_HOME取决于您的系统(在 Linux 上是~/.composer),请参阅http://getcomposer.org/doc/03-cli.md#composer-home了解更多详细信息。

回答by WiRight

Also you can use another way

你也可以用另一种方式

cd $HOME/.config/composer

And in composer.jsonfile remove some require positions

并在composer.json文件中删除一些需要的位置

After all execute composer updateThis is a long way, but more clear

毕竟executecomposer update这是很长的一段路,但更清晰