markdown 使用Composer全局安装PHP工具

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 使用Composer全局安装PHP工具相关的知识,希望对你有一定的参考价值。

# Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

```bash
$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
$ composer global require phploc/phploc
$ composer global require phpmd/phpmd
$ composer global require squizlabs/php_codesniffer
```
This will install PHPUnit and all its dependencies into the ~/.composer/vendor/ directory and, most importantly, the phpunit CLI tools are installed into ~/.composer/vendor/bin/.

Simply add this directory to your PATH in your ~/.bash_profile (or ~/.bashrc) like this:

```bash
export PATH=~/.composer/vendor/bin:$PATH
```

and phpunit is now available on your command line.

To keep your tools up to date, you simply do this:

```bash
composer global update
```
To remove a package, you edit ~/.composer/composer.json and then run composer global update.

以上是关于markdown 使用Composer全局安装PHP工具的主要内容,如果未能解决你的问题,请参考以下文章

php版本管理工具composer安装及使用

mac composer 安装

使用composer安装thinkphp[全局安装]

Linux下全局安装composer

Linux下全局安装composer方法

composer安装