installing maatwebsite/excel with laravel 9 but getting the phpoffice/phpspreadsheet errors

Viewed 2002

installing maatwebsite/excel with Laravel 9 but getting phpoffice and PHP version issues. I am using PHP 8.1, I downgrade to PHP 8.0 but still doesn't work. Even I enable the gd extention from the php.ini file.

I am installing maatwebsite using below command which is offered by official website

composer require maatwebsite/excel

enter image description here

2 Answers

I found the problem it's happening due to cache problem, we need to update the cache version.

Let me explain it with all steps

  1. Go to the php.ini file and remove ;

before

;extension=gd

after

extension=gd
  1. execute the command to change your cache
composer require psr/simple-cache ^2.0

if the above version is not work for you try it with 1.0 version (optional)

composer require psr/simple-cache ^1.0

Then install maatwebsiteexcel

composer require maatwebsite/excel

It will work like a charm

This will help you

composer require psr/simple-cache:^1.0 maatwebsite/excel

Some time composer require fails on Laravel 9 because of the simple-cache dependency, you will have to specify the psr/simple-cache version as ^1.0 in your composer.json to satisfy the PhpSpreadsheet dependency.

find solution here https://docs.laravel-excel.com/3.1/getting-started/installation.html

Related