17

Trying to install maatwebsite/excel in XAMPP 7.1.32 rev 1 via composer for mac. How do I enable these extensions in XAMPP for mac or is there any other issue. Please help me.

composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  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].
    - maatwebsite/excel 3.1.16 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.17 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.7 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.8 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.9 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.0 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.1 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.2 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.3 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.4 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.5 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - maatwebsite/excel 3.1.6 requires phpoffice/phpspreadsheet ^1.4 -> satisfiable by phpoffice/phpspreadsheet[1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
    - phpoffice/phpspreadsheet 1.9.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.8.2 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.8.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.8.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.7.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.6.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.5.2 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.5.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.5.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.4.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - phpoffice/phpspreadsheet 1.4.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - 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].

zip is enabled in my php info.

enter image description here

Neeraj
  • 231
  • 1
  • 3
  • 10
  • Would you visit if works - https://stackoverflow.com/questions/48240726/composer-require-phpoffice-phpspreadsheet-doesnt-work – Rashed Hasan Oct 11 '19 at 06:21
  • What have you tried so far? Where are you stuck? It's pretty common that the CLI version of PHP and the module for your webserver do **not** share their configuration – Nico Haase Oct 18 '21 at 06:04

8 Answers8

19

When you run composer from the command line it's unlikely you're using the same version of PHP that XAMPP is using to run your website, which is likely why it's reporting the missing zip issue here.

The simplest fix would be to ignore the platform requirements (in this case ext-zip) during the install by running composer install --ignore-platform-reqs.

George
  • 2,860
  • 18
  • 31
12

Would you please run:

composer require phpoffice/phpspreadsheet

If phpspreadsheet is already installed. Then, upgrade the version in composer.json. Just replace existing version with the compatible version.Example, Replace with:
"phpoffice/phpspreadsheet": "^1.9",

And run composer update
For more details phpspreadsheet
Also, check zip module via php -m if it exists or not for sure. If, you can't find zip module there. You have to install it, already your error saying, it does not exist in your system - visit.

Rashed Hasan
  • 3,721
  • 11
  • 40
  • 82
  • 1
    worked fine.. Need to re install php cli with zip extension. – Neeraj Oct 11 '19 at 07:52
  • 1
    Please share more details. As `maatwebsite/excel` requires that package, there should be no need to require it manually. And if the ZIP extension is missing, requiring any package that needs this extensions should still be not working – Nico Haase Oct 18 '21 at 06:06
5

I had the same problem, I am using Laravel 9.

Try this composer require maatwebsite/excel --with-all-dependencies this solve the problem.

Oscar Larriega
  • 188
  • 2
  • 8
4

If the above solutions don't work, use this

Yajra/Datatables Installation Issues phpoffice/phpspreadsheet 1.9.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.

brew update
brew install php@7.3
brew link php@7.3 --force
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Ashwani Garg
  • 1,479
  • 1
  • 16
  • 22
4

the "extension=gd" was commented in php.ini, You just that line Out of Comment and problem was solved!!!

Dixit
  • 51
  • 1
2

i just ran the following command and it worked for me .

As i have php 7.3 installed on my ubuntu system , so i ran this command .

sudo apt-get install php7.3-zip
kishan maharana
  • 623
  • 8
  • 10
1

The error says that phpoffice/phpspreadsheet ^ 1.6 is needed

Add to composer.json file:

"require": {
        "phpoffice/phpspreadsheet": "^1.9"
    },

After, Run this command in the command prompt: composer update

OR

To install the most recent version phpoffice/phpspreadsheet, run the following command

composer require phpoffice/phpspreadsheet

More info: phpoffice/phpspreadsheet | maatwebsite/excel

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
  • 3
    This error was because php cli version was missing zip extension. – Neeraj Oct 11 '19 at 08:17
  • Please share more details. As `maatwebsite/excel` requires that package, there should be no need to require it manually. And if the ZIP extension is missing, requiring any package that needs this extensions should still be not working – Nico Haase Oct 18 '21 at 06:06
1

first, remove the ; from ;extension=gd in php.ini . then, execute composer require psr/simple-cache ^2.0 to change your cache.

then install maatwebsite/excel : composer require maatwebsite/excel