33PhpSpreadsheet introduced many breaking changes by introducing
44namespaces and renaming some classes. To help you migrate existing
55project, a tool was written to replace all references to PHPExcel
6- classes to their new names.
6+ classes to their new names. But they are also manual changes that
7+ need to be done.
8+
9+ ## Automated tool
710
811The tool is included in PhpSpreadsheet. It scans recursively all files
912and directories, starting from the current directory. Assuming it was
@@ -17,12 +20,33 @@ cd /project/to/migrate/src
1720** Important** The tool will irreversibly modify your sources, be sure to
1821backup everything, and double check the result before committing.
1922
20- ## Removed deprecated things
23+ ## Manual changes
24+
25+ In addition to automated changes, a few things need to be migrated manually.
26+
27+ ### Renamed readers and writers
28+
29+ When using with ` IOFactory::createReader() ` , ` IOFactory::createWriter() `
30+ and ` IOFactory::identify() ` , the reader/writer short names are used.
31+ Those were changed, along as their corresponding class, to remove ambiguity:
32+
33+ Before | After
34+ -----------------|---------
35+ ` 'CSV' ` | ` 'Csv' `
36+ ` 'Excel2003XML' ` | ` 'Xml' `
37+ ` 'Excel2007' ` | ` 'Xlsx' `
38+ ` 'Excel5' ` | ` 'Xls' `
39+ ` 'Gnumeric' ` | ` 'Gnumeric' `
40+ ` 'HTML' ` | ` 'Html' `
41+ ` 'OOCalc' ` | ` 'Ods' `
42+ ` 'OpenDocument' ` | ` 'Ods' `
43+ ` 'PDF' ` | ` 'Pdf' `
44+ ` 'SYLK' ` | ` 'Slk' `
45+
2146
22- In addition to automated changes, usage of deprecated methods must be migrated
23- manually.
47+ ### Removed deprecated things
2448
25- ### Worksheet::duplicateStyleArray()
49+ #### Worksheet::duplicateStyleArray()
2650
2751``` php
2852// Before
@@ -32,7 +56,7 @@ $worksheet->duplicateStyleArray($styles, $range, $advanced);
3256$worksheet->getStyle($range)->applyFromArray($styles, $advanced);
3357```
3458
35- ### DataType::dataTypeForValue()
59+ #### DataType::dataTypeForValue()
3660
3761``` php
3862// Before
@@ -42,7 +66,7 @@ DataType::dataTypeForValue($value);
4266DefaultValueBinder::dataTypeForValue($value);
4367```
4468
45- ### Conditional::getCondition()
69+ #### Conditional::getCondition()
4670
4771``` php
4872// Before
@@ -52,7 +76,7 @@ $conditional->getCondition();
5276$conditional->getConditions()[0];
5377```
5478
55- ### Conditional::setCondition()
79+ #### Conditional::setCondition()
5680
5781``` php
5882// Before
@@ -62,7 +86,7 @@ $conditional->setCondition($value);
6286$conditional->setConditions($value);
6387```
6488
65- ### Worksheet::getDefaultStyle()
89+ #### Worksheet::getDefaultStyle()
6690
6791``` php
6892// Before
@@ -72,7 +96,7 @@ $worksheet->getDefaultStyle();
7296$worksheet->getParent()->getDefaultStyle();
7397```
7498
75- ### Worksheet::setDefaultStyle()
99+ #### Worksheet::setDefaultStyle()
76100
77101``` php
78102// Before
@@ -88,7 +112,7 @@ $worksheet->getParent()->getDefaultStyle()->applyFromArray([
88112
89113```
90114
91- ### Worksheet::setSharedStyle()
115+ #### Worksheet::setSharedStyle()
92116
93117``` php
94118// Before
@@ -98,7 +122,7 @@ $worksheet->setSharedStyle($sharedStyle, $range);
98122$worksheet->duplicateStyle($sharedStyle, $range);
99123```
100124
101- ### Worksheet::getSelectedCell()
125+ #### Worksheet::getSelectedCell()
102126
103127``` php
104128// Before
@@ -108,7 +132,7 @@ $worksheet->getSelectedCell();
108132$worksheet->getSelectedCells();
109133```
110134
111- ### Writer\Xls::setTempDir()
135+ #### Writer\Xls::setTempDir()
112136
113137``` php
114138// Before
@@ -117,12 +141,12 @@ $writer->setTempDir();
117141// After, there is no way to set temporary storage directory anymore
118142```
119143
120- ## Autoloader
144+ ### Autoloader
121145
122146The class ` PHPExcel_Autoloader ` was removed entirely and is replaced by composer
123147autoloading mechanism.
124148
125- ## Writing PDF
149+ ### Writing PDF
126150
127151` PHPExcel_Settings::getPdfRenderer() ` and ` PHPExcel_Settings::setPdfRenderer() `
128152were removed. ` PHPExcel_Settings::getPdfRendererName() ` and
@@ -135,7 +159,7 @@ $rendererName = \PhpOffice\PhpSpreadsheet\Writer\Pdf\MPDF::class;
135159\PhpOffice\PhpSpreadsheet\Settings::setDefaultPdfWriter($rendererName);
136160```
137161
138- ## PclZip and ZipArchive
162+ ### PclZip and ZipArchive
139163
140164Support for PclZip were dropped in favor of the more complete and modern
141165[ PHP extension ZipArchive] ( http://php.net/manual/en/book.zip.php ) .
@@ -148,7 +172,7 @@ So the following were removed:
148172- ` PHPExcel_Shared_ZipStreamWrapper `
149173
150174
151- ## Cell caching
175+ ### Cell caching
152176
153177Cell caching was heavily refactored to leverage
154178[ PSR-16] ( http://www.php-fig.org/psr/psr-16/ ) . That means most classes
@@ -174,7 +198,7 @@ to `\PhpOffice\PhpSpreadsheet::getCoordinates()` and
174198
175199Refer to [ the new documentation] ( ./memory_saving.md ) to see how to migrate.
176200
177- ## Dropped conditionally returned cell
201+ ### Dropped conditionally returned cell
178202
179203For all the following methods, it is no more possible to change the type of
180204returned value. It always return the Worksheet and never the Cell or Rule:
@@ -195,7 +219,7 @@ $cell = $worksheet->setCellValue('A1', 'value', true);
195219$cell = $worksheet->getCell('A1')->setValue('value');
196220```
197221
198- ## Standardized keys for styling
222+ ### Standardized keys for styling
199223
200224Array keys used for styling have been standardized for a more coherent experience.
201225It now uses the same wording and casing as the getter and setter:
0 commit comments