Yii applications are organized according to the model-view-controller (MVC) architectural pattern. Models represent data, business logic and rules; views are output representation of models; and controllers take input and convert it to commands for models and views.

Besides MVC, Yii applications also have the following entities:

  • entry scripts: they are PHP scripts that are directly accessible by end users. They are responsible for starting a request handling cycle.
  • applications: they are globally accessible objects that manage application components and coordinate them to fulfill requests.
  • application components: they are objects registered with applications and provide various services for fulfilling requests.
  • modules: they are self-contained packages that contain complete MVC by themselves. An application can be organized in terms of multiple modules.
  • filters: they represent code that need to be invoked before and after the actual handling of each request by controllers.
  • widgets: they are objects that can be embedded in views. They may contain controller logic and can be reused in different views.

The following diagram shows the static structure of an application:

Static Structure of Application