Quantcast
Channel: PHP8タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 521

PHP8 と Laravel8 で league/flysystem-aws-s3-v3 をインストールするときにハマった

$
0
0

Laravel で AWS S3 を操作したい時

AWS S3を操作する時はこの thephpleague/flysystem-aws-s3-v3ライブラリを利用します。

環境

  • PHP: 8.0.2
  • Laravel: 8.34.0

league/flysystem-aws-s3-v3 インストール時にエラー

$composer require league/flysystem-aws-s3-v3
Using version ^2.0 for league/flysystem-aws-s3-v3
./composer.json has been updated
Running composer update league/flysystem-aws-s3-v3
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - league/flysystem-aws-s3-v3[2.0.0, ..., 2.x-dev] require league/flysystem ^2.0.0 ->found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.3 (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.
    - league/flysystem-aws-s3-v3[2.0.0-alpha.1, ..., 2.0.0-RC1] require php ^7.2 ->your php version (8.0.2) does not satisfy that requirement.
    - Root composer.json requires league/flysystem-aws-s3-v3 ^2.0 ->satisfiable by league/flysystem-aws-s3-v3[2.0.0-alpha.1, ..., 2.x-dev].

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.

リリースを見てみると、現在の最新バージョン(2021.03.27)は、2.0.4です。
thephpleague/flysystem-aws-s3-v3のv2系を利用する場合、thephpleague/flysystemの2系をインストールする必要があるようです。

thephpleague/flysystemの現在の最新バージョン(2021.03.27)は、2.0.4です。

Laravelフレームワークが利用しているthephpleague/flysystemのバージョンを見てみましょう。

composer.json
"require":{"league/flysystem":"^1.1",},

Laravelフレームワークがleague/flysystemの1系を参照しているので、thephpleague/flysystem-aws-s3-v3の2系をインストールしようとするとエラーになってしまうという原因でした。

league/flysystemのv2はいつ対応されるのか?

Laravel9.xからleague/flysystemのv2がサポートされます。

公式ドキュメント

  • Amazon S3: league/flysystem-aws-s3-v3 ~1.0

公式ドキュメントを見ると1系をインストールするようにとのこと。
(まぁ最初に見ろよって話ですが...)

解決

$composer require league/flysystem-aws-s3-v3:^1.0

Viewing all articles
Browse latest Browse all 521

Trending Articles