Reputation: 370
I have face this problem to install maatwebsite/excel on laravel 8. How can I fix it?
NB: PHP version running 8.
Upvotes: -2
Views: 17087
Reputation: 11
First You need add extension zip in your php.ini:
ext:zip
you only need search and remove semicolon before ";ext:zip" to find php.ini file you could run php --ini
after ensuring the extension is added you need add phpspreadsheet:
composer require "phpoffice/phpspreadsheet 1.29.7"
Finally:
composer require "maatwebsite/excel:^3.1.62"
Works for me in php 8.2 and laravel 10.
Upvotes: 0
Reputation: 1
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
Upvotes: -3
Reputation: 1
I used this command from composer tips and this my case is solved: "composer require maatwebsite/excel:*"
Upvotes: -1
Reputation: 31
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
Upvotes: 3
Reputation: 1
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
Upvotes: 0
Reputation: 11
delete composer.lock (json) then run below command
composer require phpoffice/phpspreadsheet
composer require maatwebsite/excel
it is working
Upvotes: -1
Reputation: 71
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
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
Upvotes: 0
Reputation: 370
I solved the problem with
gd extension
from php.ini
filePhpSpreadsheet
Upvotes: 7
Reputation: 2087
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.
Upvotes: 0