composerを使ってみた(PHP)

スポンサードリンク

composer用ディレクトリ作成

プロジェクト用のディレクトリを作成

[sepg@sv6115 myproject]$ mkdir myproject
[sepg@sv6115 myproject]$ cd myproject

インストール

composer.pharをインストールする

[sepg@sv6115 myproject]$ curl -s https://getcomposer.org/installer | php
[sepg@sv6115 myproject]$ ll
-rw-r--r-- 1 sepg members      52  3月 27 20:09 composer.json

初期設定をおこなう。対話的に聞かれるがとりあえずすべてEnter

[sepg@sv6115 myproject]$ php composer.phar init
[sepg@sv6115 myproject]$ ll
-rw-r--r-- 1 sepg members      52  3月 27 20:09 composer.json
-rwxr-xr-x 1 sepg members 1861877  3月 27 20:08 composer.phar

初期インストール

[sepg@sv6115 myproject]$ php composer.phar install
[sepg@sv6115 myproject]$ ll
-rw-r--r-- 1 sepg members      52  3月 27 20:09 composer.json
-rwxr-xr-x 1 sepg members 1861877  3月 27 20:08 composer.phar
drwxr-xr-x 3 sepg members      54  3月 27 20:11 vendor

取得したいパッケージを指定してインストール(ここではlaravel/envoy)

[sepg@sv6115 myproject]$ php composer.phar require laravel/envoy:~1.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 11 installs, 0 updates, 0 removals
  - Installing symfony/process (v2.8.36): Downloading (100%)
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing symfony/debug (v2.8.36): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.7.0): Downloading (100%)
  - Installing symfony/console (v2.8.36): Downloading (100%)
  - Installing nategood/httpful (0.2.20): Downloading (100%)
  - Installing doctrine/inflector (v1.1.0): Downloading (100%)
  - Installing danielstjules/stringy (1.10.0): Downloading (100%)
  - Installing illuminate/contracts (v5.0.33): Downloading (100%)
  - Installing illuminate/support (v5.0.33): Downloading (100%)
  - Installing laravel/envoy (v1.2.2): Downloading (100%)
symfony/console suggests installing symfony/event-dispatcher ()
illuminate/support suggests installing jeremeamia/superclosure (Required to be able to serialize closures (~2.0).)
illuminate/support suggests installing symfony/var-dumper (Required to use the dd function (2.6.*).)
Writing lock file
Generating autoload files

インストール結果

./myproject/

[sepg@sv6115 myproject]$ ll
rw-r--r--  1 sepg members      89  3月 27 20:23 composer.json
-rw-r--r--  1 sepg members   20683  3月 27 20:24 composer.lock
-rwxr-xr-x  1 sepg members 1861877  3月 27 20:08 composer.phar
drwxr-xr-x 11 sepg members     209  3月 27 20:24 vendor

./myproject/vendor/

[sepg@sv6115 vendor]$ ll
-rw-r--r-- 1 sepg members 178  3月 27 20:24 autoload.php
drwxr-xr-x 2 sepg members  19  3月 27 20:24 bin
drwxr-xr-x 2 sepg members 269  3月 27 20:24 composer
drwxr-xr-x 3 sepg members  21  3月 27 20:24 danielstjules
drwxr-xr-x 3 sepg members  31  3月 27 20:24 doctrine
drwxr-xr-x 4 sepg members  38  3月 27 20:24 illuminate
drwxr-xr-x 3 sepg members  19  3月 27 20:24 laravel
drwxr-xr-x 3 sepg members  29  3月 27 20:24 nategood
drwxr-xr-x 3 sepg members  25  3月 27 20:24 psr
drwxr-xr-x 6 sepg members  94  3月 27 20:24 symfony

スポンサードリンク

シェアする

  • このエントリーをはてなブックマークに追加

フォローする