Skip to content

Commit 8968062

Browse files
committed
Drop PHP 8.0 support
This is according to our formal, published, policy to only support EOL PHP after 6 months. See https://phpspreadsheet.readthedocs.io/en/latest/#php-version-support Also consolidate documentation in a single place, not in the README, because it's a pain to maintain almost-duplicated-but-not-really documentation.
1 parent dbed77b commit 8968062

File tree

8 files changed

+75
-104
lines changed

8 files changed

+75
-104
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
experimental:
1111
- false
1212
php-version:
13-
- '8.0'
1413
- '8.1'
1514
- '8.2'
1615
- '8.3'
@@ -174,7 +173,7 @@ jobs:
174173
run: composer install --no-progress --prefer-dist --optimize-autoloader
175174

176175
- name: Code Version Compatibility check with PHP_CodeSniffer
177-
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.0-
176+
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.1-
178177

179178
phpstan:
180179
runs-on: ubuntu-latest

README.md

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -11,80 +11,9 @@
1111
PhpSpreadsheet is a library written in pure PHP and offers a set of classes that
1212
allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc.
1313

14-
## PHP Version Support
15-
16-
LTS: Support for PHP versions will only be maintained for a period of six months beyond the
17-
[end of life](https://www.php.net/supported-versions) of that PHP version.
18-
19-
Currently the required PHP minimum version is PHP __8.0__, and we [will support that version](https://www.php.net/eol.php) until May 2024.
20-
21-
See the `composer.json` for other requirements.
22-
2314
## Installation
2415

25-
Use [composer](https://getcomposer.org) to install PhpSpreadsheet into your project:
26-
27-
```sh
28-
composer require phpoffice/phpspreadsheet
29-
```
30-
31-
If you are building your installation on a development machine that is on a different PHP version to the server where it will be deployed, or if your PHP CLI version is not the same as your run-time such as `php-fpm` or Apache's `mod_php`, then you might want to add the following to your `composer.json` before installing:
32-
```json
33-
{
34-
"config": {
35-
"platform": {
36-
"php": "8.0"
37-
}
38-
}
39-
}
40-
```
41-
and then run
42-
```sh
43-
composer install
44-
```
45-
to ensure that the correct dependencies are retrieved to match your deployment environment.
46-
47-
See [CLI vs Application run-time](https://php.watch/articles/composer-platform-check) for more details.
48-
49-
### Additional Installation Options
50-
51-
If you want to write to PDF, or to include Charts when you write to HTML or PDF, then you will need to install additional libraries:
52-
53-
#### PDF
54-
55-
For PDF Generation, you can install any of the following, and then configure PhpSpreadsheet to indicate which library you are going to use:
56-
- mpdf/mpdf
57-
- dompdf/dompdf
58-
- tecnickcom/tcpdf
59-
60-
and configure PhpSpreadsheet using:
61-
62-
```php
63-
// Dompdf, Mpdf or Tcpdf (as appropriate)
64-
$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class;
65-
IOFactory::registerWriter('Pdf', $className);
66-
```
67-
or the appropriate PDF Writer wrapper for the library that you have chosen to install.
68-
69-
#### Chart Export
70-
71-
For Chart export, we support following packages, which you will also need to install yourself using `composer require`
72-
- [jpgraph/jpgraph](https://packagist.org/packages/jpgraph/jpgraph) (this package was abandoned at version 4.0.
73-
You can manually download the latest version that supports PHP 8 and above from [jpgraph.net](https://jpgraph.net/))
74-
- [mitoteam/jpgraph](https://packagist.org/packages/mitoteam/jpgraph) - up to date fork with modern PHP versions support and some bugs fixed.
75-
76-
and then configure PhpSpreadsheet using:
77-
```php
78-
// to use jpgraph/jpgraph
79-
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
80-
//or
81-
// to use mitoteam/jpgraph
82-
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\MtJpGraphRenderer::class);
83-
```
84-
85-
One or the other of these libraries is necessary if you want to generate HTML or PDF files that include charts; or to render a Chart to an Image format from within your code.
86-
They are not necessary to define charts for writing to `Xlsx` files.
87-
Other file formats don't support writing Charts.
16+
See the [install instructions](https://phpspreadsheet.readthedocs.io/en/latest/#installation).
8817

8918
## Documentation
9019

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"config": {
1515
"platform": {
16-
"php" : "8.0.99"
16+
"php" : "8.1.99"
1717
},
1818
"sort-packages": true,
1919
"allow-plugins": {
@@ -65,7 +65,7 @@
6565
]
6666
},
6767
"require": {
68-
"php": "^8.0",
68+
"php": "^8.1",
6969
"ext-ctype": "*",
7070
"ext-dom": "*",
7171
"ext-fileinfo": "*",

composer.lock

Lines changed: 18 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ allow you to read and write various spreadsheet file formats such as Excel and L
2424

2525
## Software requirements
2626

27-
PHP version 8.0 or newer to develop using PhpSpreadsheet. Other requirements, such as PHP extensions, are enforced by
27+
PHP version 8.1 or newer to develop using PhpSpreadsheet. Other requirements, such as PHP extensions, are enforced by
2828
composer. See the `require` section of [the composer.json file](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/composer.json)
2929
for details.
3030

@@ -33,7 +33,7 @@ for details.
3333
LTS: Support for PHP versions will only be maintained for a period of six months beyond the
3434
[end of life of that PHP version](https://www.php.net/eol.php).
3535

36-
Currently, the required PHP minimum version is PHP 8.0.
36+
Currently, the required PHP minimum version is __PHP 8.1__, and we [will support that version](https://www.php.net/eol.php) until June 2026.
3737

3838
Support for PHP versions will only be maintained for a period of six months beyond the
3939
[end of life](https://www.php.net/supported-versions) of that PHP version.
@@ -54,23 +54,54 @@ Or also download the documentation and samples if you plan to use them:
5454
composer require phpoffice/phpspreadsheet --prefer-source
5555
```
5656

57-
If you are building your installation on a development machine that is on a different PHP version to the server where it will be deployed, or if your PHP CLI version is not the same as your run-time such as `php-fpm` or Apache's `mod_php`, then you might want to add the following to your `composer.json` before installing:
58-
```json
59-
{
60-
"config": {
61-
"platform": {
62-
"php": "8.0"
63-
}
64-
}
65-
}
57+
If you are building your installation on a development machine that is on a different PHP version to the server where it
58+
will be deployed, or if your PHP CLI version is different from your run-time such as `php-fpm` or Apache's `mod_php`,
59+
then you might want to configure composer for that.
60+
See [composer documentation](https://getcomposer.org/doc/06-config.md#platform)
61+
on how to edit your `composer.json` to ensure that the correct dependencies are retrieved to match your deployment
62+
environment.
63+
64+
See [CLI vs Application run-time](https://php.watch/articles/composer-platform-check) for more details.
65+
66+
### Additional Installation Options
67+
68+
If you want to write to PDF, or to include Charts when you write to HTML or PDF, then you will need to install additional libraries:
69+
70+
#### PDF
71+
72+
For PDF Generation, you can install any of the following, and then configure PhpSpreadsheet to indicate which library you are going to use:
73+
- mpdf/mpdf
74+
- dompdf/dompdf
75+
- tecnickcom/tcpdf
76+
77+
and configure PhpSpreadsheet using:
78+
79+
```php
80+
// Dompdf, Mpdf or Tcpdf (as appropriate)
81+
$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class;
82+
IOFactory::registerWriter('Pdf', $className);
6683
```
67-
and then run
68-
```sh
69-
composer install
84+
or the appropriate PDF Writer wrapper for the library that you have chosen to install.
85+
86+
#### Chart Export
87+
88+
For Chart export, we support following packages, which you will also need to install yourself using `composer require`
89+
- [jpgraph/jpgraph](https://packagist.org/packages/jpgraph/jpgraph) (this package was abandoned at version 4.0.
90+
You can manually download the latest version that supports PHP 8 and above from [jpgraph.net](https://jpgraph.net/))
91+
- [mitoteam/jpgraph](https://packagist.org/packages/mitoteam/jpgraph) - up to date fork with modern PHP versions support and some bugs fixed.
92+
93+
and then configure PhpSpreadsheet using:
94+
```php
95+
// to use jpgraph/jpgraph
96+
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class);
97+
//or
98+
// to use mitoteam/jpgraph
99+
Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\MtJpGraphRenderer::class);
70100
```
71-
to ensure that the correct dependencies are retrieved to match your deployment environment.
72101

73-
See [CLI vs Application run-time](https://php.watch/articles/composer-platform-check) for more details.
102+
One or the other of these libraries is necessary if you want to generate HTML or PDF files that include charts; or to render a Chart to an Image format from within your code.
103+
They are not necessary to define charts for writing to `Xlsx` files.
104+
Other file formats don't support writing Charts.
74105

75106
## Hello World
76107

docs/topics/reading-and-writing-to-file.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,10 @@ $reader->loadIntoExisting("05featuredemo.csv", $spreadsheet);
577577

578578
Line endings for Unix (`\n`) and Windows (`\r\n`) are supported.
579579

580-
Mac line endings (`\r`) are supported as long as PHP itself
581-
supports them, which it does through release 8.0.
582-
Support for Mac line endings is deprecated for 8.1,
580+
Support for Mac line endings (`\r`) is deprecated since PHP 8.1,
583581
and is scheduled to remain deprecated for all later PHP8 releases;
584-
PhpSpreadsheet will continue to support them for 8.*.
585-
Support is scheduled to be dropped with release 9;
582+
PhpSpreadsheet will continue to support them for PHP 8.*.
583+
Support is scheduled to be dropped with PHP 9;
586584
PhpSpreadsheet will then no longer handle CSV files
587585
with Mac line endings correctly.
588586

samples/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require_once 'Header.php';
44

55
$requirements = [
6-
'PHP 8.0' => version_compare(PHP_VERSION, '8.0', '>='),
6+
'PHP 8.1' => version_compare(PHP_VERSION, '8.1', '>='),
77
'PHP extension XML' => extension_loaded('xml'),
88
'PHP extension xmlwriter' => extension_loaded('xmlwriter'),
99
'PHP extension mbstring' => extension_loaded('mbstring'),

src/PhpSpreadsheet/Style/NumberFormat/Wizard/DateTime.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ public function __construct($separators, ...$formatBlocks)
3131
private function mapFormatBlocks(DateTimeWizard|string $value): string
3232
{
3333
// Any date masking codes are returned as lower case values
34-
if (is_object($value)) {
35-
// We can't explicitly test for Stringable until PHP >= 8.0
36-
return $value;
34+
if ($value instanceof DateTimeWizard) {
35+
return $value->__toString();
3736
}
3837

3938
// Wrap any string literals in quotes, so that they're clearly defined as string literals

0 commit comments

Comments
 (0)