composer require weidner/goutte
したところ、以下のエラーが出た。
Your requirements could not be resolved to an installable set of packages.
Problem 1
- fabpot/goutte[v3.2.0, ..., v3.2.1] require symfony/css-selector ~2.1|~3.0 -> found symfony/css-selector[v2.1.0, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v5.4.19 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- fabpot/goutte[v3.2.2, ..., v3.2.3] require symfony/css-selector ~2.1|~3.0|~4.0 -> found symfony/css-selector[v2.1.0, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v5.4.19 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- fabpot/goutte[v3.3.0, ..., v3.3.1] require guzzlehttp/guzzle ^6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but the package is fixed to 7.5.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- weidner/goutte 1.6.0 requires fabpot/goutte ^3.2 -> satisfiable by fabpot/goutte[v3.2.0, ..., v3.3.1].
- Root composer.json requires weidner/goutte 1.6 -> satisfiable by weidner/goutte[1.6.0].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
どうやらバージョンが違うと怒られているらしい。
Laravelのバージョンを確認
php aritsan -V
私のバージョンは7.~でした。
バージョン7あたりはGoutteのバージョン1.6でいい様子。
今度はバージョンを指定してみる。
composer require weidner/goutte:1.6
また冒頭と同じエラーが。
仕方なくcomposer.jsonを編集
"require": {
~~,
"weidner/goutte": "^1.6"
},
コマンド実行
composer update
解決できました。