15
17

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メモ

Last updated at Posted at 2014-03-20

いいのか悪いのかは置いといて、忘れがちな自分用と共有用メモ。

Install

via. https://getcomposer.org/doc/00-intro.md#installation-nix

mv先はあらかじめ作ってPATHを通しておいてね。

curl -sS https://getcomposer.org/installer | php
mv -i composer.phar ~/bin/composer

# check
composer
which composer

欲しいライブラリのパッケージを探す

packagistで検索

ググって公式orGithubのリポジトリあたりを探す

昔からあるPHPのライブラリって、検索してもpearのページやpearを使ったインストール方法を解説したページがひっかかりやすい。
PHP_CodeSnifferとかね。

検索キーワードにcomposerを加えてやると、公式やGithubが引っかかる。
php codesniffer composer

パッケージのインストール

composer.jsonファイルを用意して
composer.jsonのあるディレクトリで
composer install or composer update

下はcomposer.jsonのsample。
Jenkins + PHPな環境作りの際に使ったもの
via. http://jenkins-php.org/

bin-dirで指定したパスにパッケージがインストールされます。
デフォルトは相対パスで vendor/bin
PATHを通しておきましょう。

composer.json
{
    "require-dev": {
        "phing/phing": "*",
        "phpunit/phpunit": "4.0.*",
        "squizlabs/php_codesniffer": "*",
        "phploc/phploc": "*",
        "pdepend/pdepend" : "*",
        "phpmd/phpmd" : "1.4.*",
        "sebastian/phpcpd": "*",
        "theseer/phpdox": "*"
    },
    "config": {
        "bin-dir" : "~/.composer/vendor/bin/"
    }
}
15
17
2

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
15
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?