Why not just have a map of all the classes in your project. This way you can use this rather than constantly looking at the disk.
Take a look at composer . Yes, I know that it is a dependency manager, but it also works as an autoloader .
If you added composer.json correctly, for example:
"autoload": { "classmap": [ "protected/", ] }
it will automatically generate a full array of classes, which you can download from the provider / composer / autoload_classmap.php. All you have to do is make sure the keys of the array are lowercase and you can match 1 to 1. Just remember to remember the linker-dump-autoloader call if you add new classes .
If you do this like this, consider downloading the entire autoloader (vendor / autoload.php), as this will help Yii generally limit the search for files. Get Yii even more from this by doing:
$loader = require(__DIR__ . '/../vendor/autoload.php'); Yii::$classMap = $loader->getClassMap();
In your index.php before calling the run () function. That way, Yii can just look at the class in the array.
For your problem, just call the $ loader-> getClassMap () function a second time and enter the lowercase array keys for your lookup table.
Blizz source share