In Yii, an application works through interaction of different objects, These object can be simply considered "components" or "building blocks" of the application. A component is simply an object that has been writing to perform or facilitate a particular task in a Yii application. If you have look at "Typical workflow of a Yii application" on
[http://www.yiiframework.com/doc/guide/1.1/en/basics.mvc][1]
you ll realize that apart from view and layouts (which are considered scripts) and index.php ,everything that interacts with others is a component. They all perform different tasks when the application is run.
Almost everything in Yii is a component (or derived from CComponent class).
More specifically,
CComponent implements the protocol of defining, using properties and events."
Events : Events allow you to perform a sequence (more than one) of actions when something specific happens within a component. You define an event and attach a number of functions (actions) to that event. Now, whenever that event is raised within the component, all the functions attached to that event are executed. As per my understanding, these are somewhat similar to the concept of hooks in Wordpress.
The specific application of events in a component is defined by Yii as
It is useful when you want to interrupt the normal application flow without extending base classes.
Behaviors : Behaviors are simply Yii s way of providing you with multiple inheritance , which is not supported by PHP5 while doing away with multiple function-same name problem of multiple inheritance. If you want to inherit properties and methods from Class A and B. You extend class A and then attach class B as its behavior, and then you can use all the methods of class B as well. Now, if both A and B contained a function named usefulfunction() , all calls to this function will result in execution of usefulfunction from class A only. If both class A and B were added as behaviors to a class, then the usefulfunction call would result in execution of method from the behavior which was attached first.
P.S. (I am not a expert. So please correct me if i am wrong anywhere.)