Abdullah Al Mamun
Abdullah Al Mamun

Reputation: 370

I have face a problem to install maatwebsite/excel on laravel 8 | php 8?

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

Upvotes: -2

Views: 17087

Answers (9)

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

Jeff Lawrence Tayco
Jeff Lawrence Tayco

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

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

Upvotes: -1

Fuzail Abdali
Fuzail Abdali

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

Ancy Ea
Ancy Ea

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

Walmik Deroe
Walmik Deroe

Reputation: 11

  1. delete composer.lock (json) then run below command

  2. composer require phpoffice/phpspreadsheet

  3. composer require maatwebsite/excel

it is working

Upvotes: -1

user2905554
user2905554

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

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

Upvotes: 0

Abdullah Al Mamun
Abdullah Al Mamun

Reputation: 370

I solved the problem with

  1. I just enable PHP gd extension from php.ini file
  2. installing PHP package PhpSpreadsheet

Upvotes: 7

rez
rez

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

Related Questions