How to create an extension for PHPOfiice's PHPSpredasheet ?

I was using XPHPExcel extension using CodePlex project named ‘PHPExcel’, at version 1.8

This prject migrated without any alert to github and now is part of PHPOffice suite.

The PHPExcel library is now called PHPSpreadsheet, but it’s not just a question of name. folder names and autoloader are changed.

See here: https://github.com/PHPOffice/PHPExcel/tree/1.9/src

I’d like to use it as an extension, but I’ve no idea where to start from.

Probably not the answer you are looking for, but is using the source as is and not relying on a yii extension not an option? It’s up on packagist and you could use composer to auto load everything for you (then just consult the documentation for usage)

https://packagist.org/packages/phpoffice/phpexcel

How can I do this? How to use directly the extension in Yii 1.1 ?

Agreed with georaldc. I’d rather use PHPExcel directly without a wrapper of Yii extension. It’s a generic PHP library and its usage is quite straightforward. Just create the required objects of the library, and use them to do the jobs.

IMO, what a Yii extension can do for a library like PHPExcel is quite limited. I don’t see any good reason for using it.

You may have some difficulties regarding the autoloader since you are using Yii 1.1, but it’s not that complicated. Please take a look at this wiki.

http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii

Especially the following comment

http://www.yiiframework.com/wiki/101/how-to-use-phpexcel-external-library-with-yii#c8432

I wrote it 3 years ago. It may sound self-applauding, but it’s well written and it should work for the latest Yii 1.1.x and PHPExcel 1.8.1.

Please note that the solution above may not work with PHPExcel 1.9.

But do you really need to use 1.9? As the Packagist page shows, the latest stable release is not 1.9 but 1.8.1.

https://packagist.org/packages/phpoffice/phpexcel