CWebApplication is a subclass of CApplication. It is the object behind Yii framework. It provides the functionalities needed to respond to a web request and it is the class responsible for the handling the MVC pattern in Yii.

Model–View–Controller (MVC) is a design pattern that separates the representation of information from the user’s interaction with it. The model consists of application data and business rules, and the controller mediates input, converting it to commands for the model or view.A view can be any output representation of data, such as a chart or a diagram.

CWebApplication resolves any user web request to determine which controller to use to serve the request. This is done by the processRequest method. Web requests in Yii are resolved as as controller-action pairs and additional parameters.

A controller is an instance of CController or of a class that extends CController. A controller serves the request by invoking the requested action (a controller class method which starts with action).

Users request a particular controller and action in terms of route. A route is formed by concatenating a controller ID and an action ID, separated by a slash.

The following gives the important properties and methods of the CWebApplication component.

catchAllRequest property 
public array $catchAllRequest;
//the configuration specifying a controller which should handle all 
//user requests

controllerPath 
public string getControllerPath()
public void setControllerPath(string $value)
//the directory that contains the controller classes. Defaults to 
//'protected/controllers'.

defaultController 
public string $defaultController;
//the route of the default controller, action or module. Defaults to 'site'.

layoutPath 
public string getLayoutPath()
public void setLayoutPath(string $path)
//the root directory of layout files. Defaults to 'protected/views/layouts'.

systemViewPath 
public string getSystemViewPath()
public void setSystemViewPath(string $path)
//the root directory of system view files. Defaults to 'protected/views/system'.

viewPath 
public string getViewPath()
public void setViewPath(string $path)
//the root directory of view files. Defaults to 'protected/views'.

viewRenderer read-only 
public IViewRenderer getViewRenderer()
//Returns the view renderer. If this component is registered and enabled, the 
//default view rendering logic defined in CBaseController will be replaced by 
//this renderer.

CWebApplication has the ability to contain and interact with other modules.