54
46

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

composer global

Posted at

composer に global というコマンドが増えていたので試しました。

要するに COMPOSER_HOME で composer コマンドを実行するのと同じです。
COMPOSER_HOME はデフォルトだと $HOME/.composer です(Windows だと %APPDATA%\Composer)。

試しに phpunit をインストールします。

$ composer global require 'phpunit/phpunit:*'
 :

$ ~/.composer/vendor/bin/phpunit --help
PHPUnit 3.7.28 by Sebastian Bergmann.
 :

環境変数 PATH も設定しておきます。

$ echo 'export PATH=$HOME/.composer/vendor/bin:$PATH' >> .bash_profile
$ source .bash_profile
$ which phpunit
~/.composer/vendor/bin/phpunit

$ phpunit --help
PHPUnit 3.7.28 by Sebastian Bergmann.
 :

パッケージの更新も require と同じように global をつければOKです。

$ composer global update
54
46
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
54
46

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?