読者です 読者をやめる 読者になる 読者になる

composerで、Http_Request2を入れようとしたらハマった。

API叩くアプリとかつくるとき、Http_Request2のライブラリ使いますよね。 APIたたいた結果に応じてアプリの振る舞いが変わるのをテストするのとか便利ですよね。 composer経由でHttp_Request2入れようとして、ぐぐったけど、うまくいかずハマった。

動かない

composer.json

{
  "repositories":[
    {
      "type":"pear",
      "url":"http://pear.php.net"
    }
  ],
  "require":{
    "phpunit/phpunit": "3.7.*",
    "pear-pear/HTTP_Request2": "2.1.*"
  }
}
$ php composer.phar install 

Loading composer repositories with package information
Initializing PEAR repository http://pear.php.net
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package pear-pear/http_request2 could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

うっ・・・鬱。

動いた

{
    "repositories": [
    {
        "type": "pear",
        "url": "http://pear.php.net"
    }
    ],
    "require": {
            "pear-pear.php.net/HTTP_Request2": "*"
    }
}
$ php composer.phar install

Loading composer repositories with package information
Initializing PEAR repository http://pear.php.net
Installing dependencies (including require-dev)
  - Installing pear-pear.php.net/xml_util (1.2.3)
    Loading from cache
  - Installing pear-pear.php.net/console_getopt (1.3.1)
    Loading from cache
  - Installing pear-pear.php.net/structures_graph (1.0.4)
    Loading from cache
  - Installing pear-pear.php.net/archive_tar (1.3.13)
    Loading from cache
  - Installing pear-pear.php.net/pear (1.9.5)
    Loading from cache
  - Installing pear-pear.php.net/net_url2 (2.0.9)
    Loading from cache
  - Installing pear-pear.php.net/http_request2 (2.2.1)
    Loading from cache
Writing lock file
Generating autoload files

相変わらずなぜに言及しないブログw

Thanks