I am a bit confused about the purpose of components in YII.
A YII application will most likely have a components folder containing one or more files. What components should I add to this folder? Must I always have a components folder? The sample YII application has a components folder containing Controller.php and UserIdentity.php. Is the Controller.php file always necessary?
I’ll start by saying that I’m not actually familiar with the Yii framework, but I was curious and had a look at the link. I think the idea is that components are the classes that you write when creating your Yii app. It seems that there is a base class, CComponent, that your components inherit from to get some basic functionality and access to the events system, which I’m guessing is an important part of the framework’s architecture.
A note of caution though - writing classes that extend from a framework class will tightly couple your code to that framework. It’ll make it impossible to take those classes and just drop them into a different project that doesn’t use Yii.
SitePoint did a series of articles on Yii Components a few years back, which you might find useful.