How to instance a class that have different name with it's file name??

Hi, right now i am try to use 3rd party library for extracting my data to excel using lib PHPExcel (http://www.phpexcel.net/).

The problem is the name of class is different with its file name.

For example class "PHPExcel_Writer_Excel5" is in file name "Excel5.php".

When i try to instance it (new PHPExcel_Writer_Excel5) yii return error "file not found". If i change my instance to its file name (new Excel5), yii not return any error but the lib wont work.

Any solution ?? Of course Except changing all class PHPExcel_Writer_Excel5 in file Excel5.php, to class Excel5

Thank you

Create a new dummy class inside of the Excel class maybe?


class Excel5 extends PHPExcel_Writer_Excel5 {}

Uhm, how about renaming the file?

Otherwise you can just manually include it in the relevant controller(s).

@Y!! : Its still give me error (a blank page to be exactly)

@Sander : Yes that what i thought at first (before i post this), but renaming all file and class would be tedious work. PHPExcel have many file and each other connected, more worst every file and every class have different name only main class that have same name with file name.

Anyway rightnow i got much simpler solution for extracting data to excel (not "feature full" but its works). Editing/using the view script.

Thanks