如何安装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时单元格内换行的问题,请点击这里查看

相关推荐
专注VB编程开发20年6 小时前
除了 EasyXLS,加载和显示.xlsx 格式的excel表格,并支持单元格背景色、边框线颜色和粗细等格式化特性
c++·windows·excel·mfc·xlsx
诸神缄默不语12 小时前
Excel如何给单元格填色,以及如何用Python 3实现单元格填色
开发语言·python·excel·openpyxl·patternfill
程序员小续18 小时前
Excel 表格和 Node.js 实现数据转换工具
前端·javascript·react.js·前端框架·vue·excel·reactjs
jiemidashi1 天前
WPS 中 Excel 密码取消方法大解密
经验分享·excel·wps
赵域Phoenix1 天前
挑选出行数足够的excel文件
开发语言·python·excel
oh,huoyuyan2 天前
火语言RPA--Excel读取内容
excel·rpa
初九之潜龙勿用2 天前
C# 实现完善 Excel 不规则合并单元格数据导入
开发语言·c#·.net·excel
当归10242 天前
若依-@Excel新增注解numberFormat
excel
云只上2 天前
前端插件使用xlsx-populate,花样配置excel内容,根据坐添加标替换excel内容,修改颜色,合并单元格...。
excel
小哥山水之间2 天前
在 Python 中操作 Excel 文件
开发语言·python·excel