I haven't access to my mySQL server, cannot install anything there with composer.
That's why I've downloaded PhpSpreadsheet files from here https://php-download.com/package/phpoffice/phpspreadsheet and packed to my local php directory.
But also the easy sample doesn't work. There just comes the error message
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in [directory] on line 5
I want to switch from PhpExcel to PhpSpreadsheet. Unfortunately the usual installation of PhpSpreadsheet is with composer.
But ... why does the "use" not work in my code? Must be there the folders ..\Spreadsheet and ..\Xlsx present? They aren't. Where would I get them from ?
Thanks, Markus
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');
$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');