How do I install maatwebsite/excel?
Asked Answered
C

7

10

I'm trying to install maatwebsite/excel; however, I can't get it to work.

I tried deleting the composer.lock file and running:

composer install
composer update

I also tried:

composer require maatwebsite/excel --update-with-dependencies

Neither method worked.

The error I received was:

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.
Chatelaine answered 1/10, 2019 at 6:33 Comment(0)
I
7

In my stuation, the error happened because composer wasn't able to load the phpoffice/phpspreadsheet package. Normally, composer is capable of installing dependencies. However, there were some missing php extension on the server – like php zip. Once I installed those extensions, the problem was solved.

Instead of ignoring requirements, I suggest you to look into the source of the problem.

Intersect answered 21/1, 2020 at 13:30 Comment(1)
This worked for me: composer require maatwebsite/excel -W (Which the [-W] means require all dependencies update)Tret
C
13

Apparently, it was a dependency error. To ignore this dependency requirement run:

composer require maatwebsite/excel --ignore-platform-reqs
Chatelaine answered 1/10, 2019 at 7:17 Comment(2)
maatwebsite/excel 3.1.10 requires phpoffice/phpspreadsheet, so you should not require 'maatwebsite/excel', require 'phpoffice/phpspreadsheet' instead.Enthrone
Thanks you so much it work for me laravel 8Wagoner
O
10
sudo apt-get install php-zip&&sudo apt-get install php-gd

it helped me

Ophthalmoscopy answered 17/6, 2020 at 17:42 Comment(0)
I
7

In my stuation, the error happened because composer wasn't able to load the phpoffice/phpspreadsheet package. Normally, composer is capable of installing dependencies. However, there were some missing php extension on the server – like php zip. Once I installed those extensions, the problem was solved.

Instead of ignoring requirements, I suggest you to look into the source of the problem.

Intersect answered 21/1, 2020 at 13:30 Comment(1)
This worked for me: composer require maatwebsite/excel -W (Which the [-W] means require all dependencies update)Tret
S
3

GD (GIF Draw) extension is required for this package. You need to enable the gd extension from php.ini file.

search for this file in php.ini: extension=gd

Stonehenge answered 13/7, 2021 at 7:26 Comment(1)
This is the real answer!Heady
T
0

Go to your php.ini file and look for the line **;extension=gd** and change it to **extension=gd**

If this line is not there then look for **gd** only and un comment it.

Tutto answered 5/3, 2021 at 8:5 Comment(0)
V
0

I tried many things but this worked for me.

sudo apt-get install php-zip&&sudo apt-get install php-gd I was getting. 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].

As Teoman Tıngır said Composer should update dependencies but sometime due to some missing extension it cannot be able to do that that's why these errors come up.

Victorious answered 6/5, 2021 at 15:29 Comment(0)
G
0

go to php.ini and uncomment(extension=gd) remove ; before extension=gd it helped me

Groomsman answered 17/5, 2022 at 7:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.