2016-11-27 15:11:16 +00:00
|
|
|
# Migration from PHPExcel
|
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
PhpSpreadsheet introduced many breaking changes by introducing
|
|
|
|
namespaces and renaming some classes. To help you migrate existing
|
|
|
|
project, a tool was written to replace all references to PHPExcel
|
2018-10-21 07:28:39 +00:00
|
|
|
classes to their new names. But there are also manual changes that
|
2017-10-17 07:16:54 +00:00
|
|
|
need to be done.
|
|
|
|
|
|
|
|
## Automated tool
|
2016-11-27 15:11:16 +00:00
|
|
|
|
2020-05-02 03:34:20 +00:00
|
|
|
[RectorPHP](https://github.com/rectorphp/rector) can be used to migrate
|
|
|
|
automatically your codebase. Assuming your files to be migrated lives
|
|
|
|
in `src/`, you can run the migration like so:
|
2016-11-27 15:11:16 +00:00
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
``` sh
|
2020-05-02 03:34:20 +00:00
|
|
|
composer require rector/rector --dev
|
|
|
|
vendor/bin/rector process src --set phpexcel-to-phpspreadsheet
|
|
|
|
composer remove rector/rector
|
2016-11-27 15:11:16 +00:00
|
|
|
```
|
|
|
|
|
2020-05-02 03:34:20 +00:00
|
|
|
For more details, see
|
|
|
|
[RectorPHP blog post](https://getrector.org/blog/2020/04/16/how-to-migrate-from-phpexcel-to-phpspreadsheet-with-rector-in-30-minutes).
|