Extending Yii
Extending Yii is a common activity during development. For example, when you write a new controller, you extend Yii by inheriting its CController class; when you write a new widget, you are extending CWidget or an existing widget class. If the extended code is designed to be reused by third-party developers, we call it an extension.
An extension usually serves for a single purpose. In Yii's terms, it can be classified as follows,
- application component
- behavior
- widget
- controller
- action
- filter
- console command
- validator: a validator is a component class extending CValidator.
- helper: a helper is a class with only static methods. It is like global functions using the class name as their namespace.
- module: a module is a self-contained software unit that consists of models, views, controllers and other supporting components. In many aspects, a module resembles to an application. The main difference is that a module is inside an application. For example, we could have a module that provides user management functionalities.
An extension can also be a component that does not fall into any of the above categories. As a matter of fact, Yii is carefully designed such that nearly every piece of its code can be extended and customized to fit for individual needs.