-2

I have face this problem to install maatwebsite/excel on laravel 8. How can I fix it? NB: PHP version running 8. Problem Screen shoot

Abdullah Al Mamun
  • 310
  • 2
  • 4
  • 14

8 Answers8

6

I solved the problem with

  1. I just enable PHP gd extension from php.ini file
  2. installing PHP package PhpSpreadsheet
Abdullah Al Mamun
  • 310
  • 2
  • 4
  • 14
2

I have just used composer require maatwebsite/excel -W --ignore-platform-req=ext-zip and this has worked for me on linux ubuntu 20 with php 8.1

SEYED BABAK ASHRAFI
  • 4,093
  • 4
  • 22
  • 32
0

The problem is about Laravel Excel requirements. It seems PhpSpreadsheet: ^1.15 is not installed. Here is the list of requirements for Laravel-Excel 3.1,

PHP: ^7.2\|^8.0
Laravel: ^5.8
PhpSpreadsheet: ^1.15
PHP extension php_zip enabled
PHP extension php_xml enabled
PHP extension php_gd2 enabled
PHP extension php_iconv enabled
PHP extension php_simplexml enabled
PHP extension php_xmlreader enabled
PHP extension php_zlib enabled

Make sure these are installed and enabled on your php.ini. Also make sure your php version on composer.json is set like this:

"require": {
    "php": "^7.2|^8.0",
},

Instead of something like this "php": ">=7.2". Check this out for more information. Please let me know if it worked.

amrezzd
  • 1,787
  • 15
  • 38
  • Please share more details. Why should it be relevant to change the PHP requirements in the `composer.json`? Does this have any influence when set in an application's configuration? – Nico Haase May 21 '21 at 20:31
  • @NicoHaase It might be about compatibility issue mentioned [here](https://github.com/composer/composer/issues/9529#issuecomment-774506349), that is why I suggested to try changing the version. – amrezzd May 22 '21 at 04:07
0

I just want share another answer related here. If you run on unix (linux), try install php-gd using command line. Try check other answer related to your system.

sudo apt-get update
sudo apt-get install php8.0-gd

related:

How to install PHP GD in Ubuntu

install php-gd ext on Debian

Issue with enabling GD in PHP

If you using windows. Use this command.

composer require maatwebsite/excel --ignore-platform-reqs

This problem happen only on php 8.x! perhaps on lastest php 7. The problem same as above and still failed even php-gd is active. When type

composer require maatwebsite/excel

the error still the same. When checking using

php -i

(basicly same as phpinfo in console). We can see php gd is active. This answer is not recommended at the moment. Fixed still on the way related to this issue.

related link:

https://github.com/Maatwebsite/Laravel-Excel/discussions/3191

PHP8 is supported, make sure to use 3.1.30 of the package as mention above. To see other issue, please read this link.

https://github.com/Maatwebsite/Laravel-Excel/issues/2936

  • this solution aims to not downgrade php. As of this mention on github, improvements are being made related to php 8 new behaviour – user2905554 Oct 03 '21 at 16:59
0

I solved using
Enable zip and gd extension in php.ini
or install using sudo apt-get install php8.0-gd
sudo apt-get install php8.0-zip use composer require maatwebsite/excel:^3.1 -W
-W is for with-all-dependencies

Ancy Ea
  • 1
  • 3
-1
  1. delete composer.lock (json) then run below command

  2. composer require phpoffice/phpspreadsheet

  3. composer require maatwebsite/excel

it is working

  • 2
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 26 '21 at 06:17
  • Deleting the whole `composer.json` sounds like a bad idea. Could you even explain how this should magically resolve the given errors? – Nico Haase Nov 26 '21 at 06:51
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 26 '21 at 12:44
-1

I used this command from composer tips and this my case is solved: "composer require maatwebsite/excel:*"

  • Please don't post duplicated answers, unless you want to share new insights. If this is the case here, please add some explanation to your answer such that others can learn from it – Nico Haase Mar 15 '23 at 14:03
-3

In composer.json change the require "maatwebsite/excel": "1.1" or something into "maatwebsite/excel": "1.*" then run this command

"composer update"

into your root directory or project folder

  • v1 of that package is pretty outdated. It has seen its latest release in 2017, and I highly doubt that it is compatible with PHP 8 after all. Also, it requires Laravel v4 or v5, and this means it won't work with Laravel v8 – Nico Haase May 30 '23 at 06:24