网络知识 娱乐 thinkphp5 添加 phpoffice/phpspreadsheet - topthink/think-installer v1.0.12 require

thinkphp5 添加 phpoffice/phpspreadsheet - topthink/think-installer v1.0.12 require

phpexcel php操作excel的类库停止更新换成新的 phpoffice/phpspreadsheet

composer require dts/ebay-sdk-php
Using version ^17.0 for dts/ebay-sdk-php
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing dts/ebay-sdk-php (17.0.0): Downloading (100%)
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.

当然

composer update phpoffice/phpword

word也一样

操作

composer require phpoffice/phpspreadsheet

报错

Problem 1
    - topthink/think-installer v1.0.12 requires composer-plugin-api ^1.0 -> foun
d composer-plugin-api[2.0.0] but it does not match the constraint.
    - topthink/framework v5.0.21 requires topthink/think-installer ~1.0 -> satis
fiable by topthink/think-installer[v1.0.12].
    - topthink/framework is locked to version v5.0.21 and an update of this pack
age was not requested.

You are using Composer 2, which some of your plugins seem to be incompatible wit
h. Make sure you update your plugins or report a plugin-issue to ask them to sup
port Composer 2.

Installation failed, reverting ./composer.json and ./composer.lock to their orig
inal content.

有包不支持你的 composer 2,需要用 composer 1 安装

composer self-update --1

安装 composer 1,若要安装 composer 2 可使用

composer self-update --2

更新后

composer require phpoffice/phpspreadsheet
topthink/think-installer contains a Composer plugin which is currently not in yo
ur allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "topthink/think-installer" to execute code and wish to enable it no
w? (writes "allow-plugins" to composer.json) [y,n,d,?]


选择Y

amazonerp>composer require phpoffice/phpspre
adsheet
topthink/think-installer contains a Composer plugin which is currently not in yo
ur allow-plugins config. See https://getcomposer.org/allow-plugins
Do you trust "topthink/think-installer" to execute code and wish to enable it no
w? (writes "allow-plugins" to composer.json) [y,n,d,?]

选择y


The "topthink/think-installer" plugin was skipped because it requires a Plugin A
PI version ("^1.0") that does not match your Composer installation ("2.3.0"). Yo
u may need to run composer update with the "--no-plugins" option.
Using version ^1.22 for phpoffice/phpspreadsheet
./composer.json has been updated
The "topthink/think-installer" plugin was skipped because it requires a Plugin A
PI version ("^1.0") that does not match your Composer installation ("2.3.0"). Yo
u may need to run composer update with the "--no-plugins" option.
Running composer update phpoffice/phpspreadsheet
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - topthink/think-installer v1.0.12 requires composer-plugin-api ^1.0 -> foun
d composer-plugin-api[2.3.0] but it does not match the constraint.
    - karsonzhang/fastadmin-addons 1.1.4 requires topthink/think-installer >=1.0
.10 -> satisfiable by topthink/think-installer[v1.0.12].
    - karsonzhang/fastadmin-addons is locked to version 1.1.4 and an update of t
his package was not requested.

You can also try re-running composer require with an explicit version constraint
, e.g. "composer require phpoffice/phpspreadsheet:*" to figure out if any versio
n is installable, or "composer require phpoffice/phpspreadsheet:^2.1" if you kno
w which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their orig
inal content.

吧compposer降级

D:phpstudy_proWWW24.comamazonerpamazonerp>composer self-update --1
Warning: You forced the install of 1.10.25 via --1, but 2.3.4 is the latest stab
le version. Updating to it via composer self-update --stable is recommended.
Upgrading to version 1.10.25 (1.x channel).

Use composer self-update --rollback to return to version 2.3.4

composer require phpoffice/phpspre
adsheet
Warning from https://mirrors.aliyun.com/composer: Support for Composer 1 is depr
ecated and some packages will not be available. You should upgrade to Composer 2
. See https://blog.packagist.com/deprecating-composer-1-support/


  [ComposerDownloaderTransportException]
  The "https://mirrors.aliyun.com/composer/p/provider-2017%24b5821b2a546c33da
  ac76e494e604e1154f84a17bbf22858644e5cb028529ff1d.json" file could not be do
  wnloaded (HTTP/1.1 404 Not Found)
 

镜像没有这个文件,阿里云的镜像是 composer2.0的包

修改当前项目的 composer.json 配置文件:

打开命令行窗口(windows用户)或控制台(Linux、Mac 用户),进入你的项目的根目录(也就是 composer.json 文件所在目录),执行如下命令:

复制

composer config repo.packagist composer https://packagist.phpcomposer.com

composer require phpoffice/phpspre
adsheet ^1.2