Customizing the Yii autoloader
Yii uses a naming convention and an autoloader to load only classes that are really needed and to avoid including files explicitly. As other frameworks and libraries could use a different naming convention, Yii provides an ability to customize rules of autoloading classes. In the Using Zend Framework from Yii recipe in this chapter, we used Zend_Loader_Autoloader
to be able to use Zend Framework classes without including them explicitly. If we are using only Zend Framework's core classes, then its complex autoloader is a bit too much. Moreover, there are still require_once calls in each Zend Framework class, so it still loads tons of unused files. In this recipe, we will create a very simple and fast autoloader that will allow us to do the same, but faster.
Getting ready
Let's prepare our environment and create some initial code to test our autoloader.
Create a fresh application by using
yiic webapp.Download Zend Framework 1 code (the minimal version is enough...