コンポーザーさんに「LaravelにGuzzleがインストールできないよ」と怒られた

Laravel

先日、Laravelで開発中のプロジェクトにてCurlを使う必要性が発生しました

ところが、GuzzleというCurl用パッケージをコンポーザーを使ってインストールしようとしたところ、以下のエラーに遭遇してしまいました

$ composer require guzzlehttp/guzzle

Your requirements could not be resolved to an installable set of packages.
Problem 1
– Installation request for league/oauth1-client (locked at 1.7.0) -> satisfiable by league/oauth1-client[1.7.0].
– Can only install one of: guzzlehttp/guzzle[7.0.0, 6.5.x-dev].
– Can only install one of: guzzlehttp/guzzle[7.0.0-beta.1, 6.5.x-dev].
– Can only install one of: guzzlehttp/guzzle[7.0.0-beta.2, 6.5.x-dev].
– Can only install one of: guzzlehttp/guzzle[7.0.0-rc.1, 6.5.x-dev].
– Can only install one of: guzzlehttp/guzzle[7.0.1, 6.5.x-dev].
– Can only install one of: guzzlehttp/guzzle[7.0.x-dev, 6.5.x-dev].
– Can only install one of: guzzlehttp/guzzle[7.1.x-dev, 6.5.x-dev].
– Conclusion: install guzzlehttp/guzzle 6.5.x-dev
– Installation request for guzzlehttp/guzzle ^7.0 -> satisfiable by guzzlehttp/guzzle[7.0.0, 7.0.0-beta.1, 7.0.0-beta.2, 7.0.0-rc.1, 7.0.1, 7.0.x-dev, 7.1.x-dev].
Installation failed, reverting ./composer.json to its original content.

原因

league/oauth1-clientのバージョンが古い(1.7.0)ことが原因でした

$composer require league/oauth1-client

まずはleague/oauth1-clientをアップデートします

$composer require guzzlehttp/guzzle
 
Using version ^1.8 for league/oauth1-client
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Updating league/oauth1-client (1.7.0 => v1.8.1): Downloading (100%)         
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating optimized autoload files

再びGuzzleのインストールを実行

無事、Guzzleがインストールできました!