如何安装 maatwebsite/excel?

su3*_*158 3 composer-php laravel-6

我正在尝试安装maatwebsite/excel;但是,我无法让它工作。

我尝试删除composer.lock文件并运行:

composer install
composer update
Run Code Online (Sandbox Code Playgroud)

我也试过:

composer require maatwebsite/excel --update-with-dependencies
Run Code Online (Sandbox Code Playgroud)

两种方法都不奏效。

我收到的错误是:

Problem 1
- maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.11 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.12 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.13 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
 .
 .
 .
 .

- maatwebsite/excel 3.1.14 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
- maatwebsite/excel 3.1.15 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].   
- Installation request for maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, 3.1.1, 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.14, 3.1.15, 3.1.16, 3.1.17, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.8, 3.1.9, 3.1.x-dev, 3.2.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
- C:\Users\user\Downloads\php-7.3.8-nts-Win32-VC15-x64\php.ini
You can also run `php --ini` inside terminal to see which files are used 
by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.
Run Code Online (Sandbox Code Playgroud)

Ант*_*вич 10

sudo apt-get install php-zip&&sudo apt-get install php-gd
Run Code Online (Sandbox Code Playgroud)

它帮助了我


su3*_*158 8

显然,这是一个依赖错误。要忽略此依赖项要求,请运行:

composer require maatwebsite/excel --ignore-platform-reqs
Run Code Online (Sandbox Code Playgroud)

  • `maatwebsite/excel 3.1.10 需要 phpoffice/phpspreadsheet`,所以你不应该需要 'maatwebsite/excel',而是需要 'phpoffice/phpspreadsheet'。 (2认同)

Teo*_*gır 7

在我的情况下,发生错误是因为作曲家无法加载\nphpoffice/phpspreadsheet包。通常,composer 能够安装依赖项。但是,服务器 \xe2\x80\x93 上缺少一些 php 扩展,例如 php zip。一旦我安装了这些扩展,问题就解决了。

\n

我建议您不要忽视需求,而是调查问题的根源。

\n

  • 这对我有用:*composer require maatwebsite/excel -W* (其中 [-W] 意味着需要所有依赖项更新) (2认同)