Yii Autoloader With Third Party Classes


I have third party classes, that I have imported into the framework thru Yii:Import and set the alias. The issue I’m having is their are some classes that don’t follow the following convention. I could be wrong about this convention, just an FYI with the Autoloader.

The Correct Convention Example


Class Customer


// …


The issue


Class Person




The problem is when I call the Person Class it does not load the class because the filename. I can not just rename the file (I wish). I could just have a require/include in the code, but are their any better solutions?

A simple solution (depending on the number of classes) would be creating new classes with the proper name (Person.php for the class Person) that just extend those classes and add a regular include/require to the file.

This way you can still make use of the autoloader.

So basically a wrapper.

you cannot not redeclare classes in php you might have to namespace it then extend from the original ones

You’re right, forgot that.