February 6, 2014

composer initコマンドを使ってみる

composer initコマンドってあるのかなーと思って試しに打ってみたらあったので使ってみました。パッケージ名で検索して、バージョン指定しつつcomposer.jsonを作れるのが良いなーと思いました。

以下は、FacebookのPHP SDKを検索して3.2.*指定しています。
$ composer init


  Welcome to the Composer config generator



This command will guide you through creating your composer.json config.

Package name (<vendor>/<name>) [admin/facebook]: xxx/yyy
Description []: desc
Author [mamor <mamor@example.com>]:
Minimum Stability []:
License []:

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]?
Search for a package []: facebook

Found 15 packages matching facebook

   [0] facebook/webdriver
   [1] facebook/xhprof
   [2] kdyby/facebook
   [3] opauth/facebook
   [4] facebook/php-sdk
   [5] friendsofsymfony/facebook-bundle
   [6] euskadi31/facebook
   [7] boparaiamrit/facebook
   [8] playground/facebook
   [9] thomaswelton/facebook-php-sdk
  [10] grom/facebook-service-provider
  [11] thomaswelton/laravel-facebook
  [12] eden/facebook
  [13] culshaw/facebook
  [14] tobiassjosten/facebook-service-provider

Enter package # to add, or the complete package name if it is not listed []: 4
Enter the version constraint to require []: 3.2.*
Search for a package []:
Would you like to define your dev dependencies (require-dev) interactively [yes]? no

{
    "name": "xxx/yyy",
    "description": "desc",
    "require": {
        "facebook/php-sdk": "3.2.*"
    },
    "authors": [
        {
            "name": "mamor",
            "email": "mamor@example.com"
        }
    ]
}

Do you confirm generation [yes]?

No comments:

Post a Comment