I am trying to add PhpSpreadsheet to my CodeIgniter 4 project.
composer require phpoffice/phpspreadsheet
and I am getting this errors:
Your requirements could not be resolved to an installable set of packages.
Problem 1 - Root composer.json requires phpoffice/phpspreadsheet ^1.24 -> satisfiable by phpoffice/phpspreadsheet[1.24.0]. - phpoffice/phpspreadsheet 1.24.0 requires ext-gd * -> it is missing from your system. Install or enable PHP's gd extension.
To enable extensions, verify that they are enabled in your .ini files: - C:\Program Files\xampp\php\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 and ./composer.lock to their original content.
How to fix it?
My composer.json:
{
"name": "codeigniter4/appstarter",
"type": "project",
"description": "CodeIgniter4 starter app",
"homepage": "https://codeigniter.com",
"license": "MIT",
"require": {
"php": "^7.4 || ^8.0",
"codeigniter4/framework": "^4.0"
},
"require-dev": {
"fakerphp/faker": "^1.9",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^9.1"
},
"suggest": {
"ext-fileinfo": "Improves mime type detection for files"
},
"autoload": {
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\Support\\": "tests/_support"
}
},
"scripts": {
"test": "phpunit"
},
"support": {
"forum": "http://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
}
}
@edit:
This post help me: https://stackoverflow.com/a/66615935/7683760