bseddon / php-pivottables-4-excel-lite

Adds limited Excel pivot table functionality to PHPOffice/PHPSpreadsheet
GNU Lesser General Public License v3.0
16 stars 12 forks source link

PHP 8.x - Can't require because of using PHP 8 #3

Closed christoph-kloeppner closed 2 years ago

christoph-kloeppner commented 2 years ago

I would love to use the extension. I am currently using PHP 8. Unfortunately the project is limited to PHP 7.x. Is it possible to change this? Or are there compatibility issues?

bseddon commented 2 years ago

I've not tried with PHP 8 but there should be no issue using it. My guess is that composer is not allowing it to be installed. At the time the extension was created, PHP had not been released.

Thanks for letting me know and I will update the composer file but I can't get to it immediately. If composer is the constraint, you can edit your composer.json file (in the same folder that contains the 'vendor' folder) to change the restriction.

bseddon commented 2 years ago

The composer.json file has been updated.

TeLiXj commented 2 years ago

You may need to update the JSON of the dependencies because lyquidity/utilities and lyquidity/xml can't be installed in PHP 8.0 and 8.1. And not directly related with this, but you can create tags versions for each update to avoid dev stability in our main projects ;)

bseddon commented 2 years ago

Thanks for letting me know about the composer file issue of the dependent projects. The respective files have been updated.

TeLiXj commented 2 years ago

Thanks, but now fails compatibility with PhpSpreadsheet PHP Fatal error: Declaration of lyquidity\xbrl_validate\PhpOffice\PhpSpreadsheet\Writer\Xlsx::save($pFilename): void must be compatible with PhpOffice\PhpSpreadsheet\Writer\Xlsx::save($filename, int $flags = 0): void in /vendor/lyquidity/php-pivottables-4-excel-lite/phpspreadsheet/XlsxWriter.php on line 201

bseddon commented 2 years ago

This is an old project and it seems PHPSpreadsheet has changed the signature of the save function in the version you are using. The version of PHPSpreadsheet I used when I created this project is 1.5 and the composer file tries to restrict use to this version.

I think you maybe using a later version of PHPSpreadsheet which may introduce incompatibilities such as this signature. I recommend you clone the project then you will be able to make this and any other changes you need to be compatible with the PHPSpreadsheet version you are using.

As you can see, the save function now includes an optional $flag parameter. As well as fixing the signature its likely you will need to update the function to use this flag and make other changes.

christoph-kloeppner commented 2 years ago

@TeLiXj That is correct, but the problem with the incompatibility with PHPSpreadsheet (newest version) was there before too. This has nothing to do with the update. I simply set the PHPSpreadsheet version hard to the version 1.5 (composer.json).

TeLiXj commented 2 years ago

But I need the last version of PhpSpreadsheet, nothing to do in my case. I'm going to use other options. Thanks both.