Notice! This post is more than a year old. It may be outdated.
Sometimes I want to have access to all of my classes in a Yii app externally. For example, I would like to run an external PHP script with cron and I would like to use my application classes. To achieve that, I created a separate classloader file.
This creates a Yii console application and in addition autoloads all classes managed by Composer. Now you can use your application classes for example in a cron script.