i am really a beginner and i am trying to install PhpSpreadsheet in Codeigniter 4 in the ThirdParty folder. The instructions I find going around the net refer to "composer" but I have no idea how to run this command (I'm in Windows 10, XAMPP, Codeigniter 4.1.1 and PHP 7.3). I would still like to install everything manually.
So I proceeded like this:
- In the ThirdParty folder I created a PhpOffice folder and downloaded the contents of PhpSpreadsheet.
- I then modified the Autoload.php file (from the codeigniter app/Config folder) in this way:
public $psr4 = [
APP_NAMESPACE => APPPATH, // For custom app namespace
'Config' => APPPATH . 'Config',
'PhpOffice\PhpSpreadsheet' => APPPATH . 'ThirdParty/PhpOffice/PhpSpreadsheet',
];
Then I created the Example.php controller like so:
<? php
namespace App\Controllers;
use \PhpOffice\PhpSpreadsheet\Spreadsheet;
use \PhpOffice\PhpSpreadsheet\Writer\Xlsx;
class Example extends BaseController
{
public function index ()
{
$ spreadsheet = new Spreadsheet ();
}
}
Well this line of code alone generates the following error:
Error
Interface 'Psr \ SimpleCache \ CacheInterface' not found
APPPATH \ ThirdParty \ PhpOffice \ PhpSpreadsheet \ Collection \ Memory.php at line 13
I have no idea how to fix. Thanks in advance to all those who will answer