如何安装maatwebsite/excel?

背景

项目要下载内容,那最好是用扩展了,常用的也就是maatwebsite/excel,但是今天安装的提示异常

错误如下:

  Problem 1
    - maatwebsite/excel[3.1.28, ..., 3.1.30] require phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0].
    - maatwebsite/excel[3.1.31, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, ..., 1.29.0].
    - maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[1.16.0, ..., 1.29.0].
    - maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[1.15.0, ..., 1.29.0].
    - maatwebsite/excel[3.1.22, ..., 3.1.25] require phpoffice/phpspreadsheet ^1.14 -> satisfiable by phpoffice/phpspreadsheet[1.14.0, ..., 1.29.0].
    - phpoffice/phpspreadsheet[1.14.0, ..., 1.28.0] require maennchen/zipstream-php ^2.1 -> satisfiable by maennchen/zipstream-php[2.1.0, ..., v2.x-dev].
    - phpoffice/phpspreadsheet 1.29.0 requires maennchen/zipstream-php ^2.1 || ^3.0 -> satisfiable by maennchen/zipstream-php[2.1.0, ..., v2.x-dev, 3.0.0-beta.1, ..., 3.1.0].
    - maatwebsite/excel 3.1.0 requires illuminate/support ^5.5 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - maatwebsite/excel[3.1.1, ..., 3.1.6] require illuminate/support 5.5.* || 5.6.* || 5.7.* -> found illuminate/support[v5.5.0, ..., 5.7.x-dev] but these were not loaded, likely because it conflicts with another require.
    - maatwebsite/excel[3.1.7, ..., 3.1.15] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.* -> found illuminate/support[v5.5.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - maatwebsite/excel[3.1.16, ..., 3.1.18] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*|^6.0 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev] but these were not loaded, likely because it conflicts with another require.
    - maatwebsite/excel[3.1.19, ..., 3.1.21] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev] but these were not loaded, likely because it conflicts with another require.
    - maennchen/zipstream-php[2.2.0, ..., v2.x-dev] require php ^8.0 -> your php version (7.4.14) does not satisfy that requirement.
    - maennchen/zipstream-php[2.1.0, ..., 2.2.6] require psr/http-message ^1.0 -> found psr/http-message[1.0, 1.0.1, 1.1] but the package is fixed to 2.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.
    - maennchen/zipstream-php[3.0.0-beta.1, ..., 3.1.0] require php-64bit ^8.1 -> your php-64bit version (7.4.14) does not satisfy that requirement.
    - Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

解决之路

看到报错,错误的发生是因为composer无法加载phpoffice/phpspreadsheet包。正常情况下,composer能够安装依赖项,现手动试试让它安装的时候自动安装依赖项,

composer require maatwebsite/excel --update-with-dependencies

然后就正常了哈

导出excel时单元格内换行的问题,请点击这里查看

相关推荐
Python大数据分析@8 小时前
python操作CSV和excel,如何来做?
开发语言·python·excel
John.liu_Test8 小时前
js下载excel示例demo
前端·javascript·excel
ruleslol11 小时前
VBA02-初识宏——EXCEL录像机
excel·vba
IT铺子11 小时前
制定Excel使用规范和指导,提升数据处理的效率和准确性,减少错误和数据丢失的风险
excel
是萝卜干呀11 小时前
Backend - Python 爬取网页数据并保存在Excel文件中
python·excel·table·xlwt·爬取网页数据
神奇夜光杯16 小时前
Python酷库之旅-第三方库Pandas(202)
开发语言·人工智能·python·excel·pandas·标准库及第三方库·学习与成长
小c君tt17 小时前
MFC中Excel的导入以及使用步骤
c++·excel·mfc
一名技术极客19 小时前
Vue2 doc、excel、pdf、ppt、txt、图片以及视频等在线预览
pdf·powerpoint·excel·文件在线预览
用余生去守护20 小时前
【反射率】-- Lab 转换(excel)
excel
进击的六角龙20 小时前
Python中处理Excel的基本概念(如工作簿、工作表等)
开发语言·python·excel