I have tried to install composer require maatwebsite/excel and I have tried several times but still getting errors and I’m using laravel 9.23.0 and PHP v8.0.5 here is the error.
Using version ^3.1 for maatwebsite/excel
./composer.json has been updated
Running composer update maatwebsite/excel
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
– maatwebsite/excel[3.1.36, …, 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, …, 1.24.1].
– maatwebsite/excel[3.1.0, …, 3.1.25] require php ^7.0 -> your php version (8.0.5) does not satisfy that requirement.
– maatwebsite/excel[3.1.26, …, 3.1.35] require illuminate/support 5.8.*|^6.0|^7.0|^8.0 -> found illuminate/support[v5.8.0, …, 5.8.x-dev, v6.0.0, …, 6.x-dev, v7.0.0, …, 7.x-dev, v8.0.0, …, 8.x-dev] but these were not loaded, likely because it
conflicts with another require.
– phpoffice/phpspreadsheet[1.18.0, …, 1.24.1] require ext-gd * -> it is missing from your system. Install or enable PHP’s
gd extension.
– Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, …, 3.1.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
– C:xamppphpphp.ini
You can also run php --ini
in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with --ignore-platform-req=ext-gd
to temporarily ignore these required extensions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require maatwebsite/excel:*" to figure out if any version is installable, or "composer require maatwebsite/excel:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
2
Answers
As the error message mentioning it the PHP GD extension is missing on your system.
Google for
install php gd
for you systemwindows
,mac
,linux
and follow the installation instructions.For
linux
it will be:If you are using a
docker
container, then you can use the following:After the gd extension is installed try to install the package again. If it fails check if there is another package missing and install it in a similar way.
According to docs the requirements are:
^7.2|^8.0
^5.8|^6.0|^7.0|^8.0
^1.21
^1.0
php_zip
enabledphp_xml
enabledphp_gd2
enabledphp_iconv
enabledphp_simplexml
enabledphp_xmlreader
enabledphp_zlib
enabledGo to the
php.ini
file by you xampp console. Search this;extension=gd
and remove;
then restart the server.Check if the other php extension are enabled to.