Each time when a Yii application handles a request, it undergoes a similar workflow.
- A user makes a request to the entry script
- The entry script loads the application configuration and creates
an application instance to handle the request.
- The application resolves the requested route with the help of
the request application component.
- The application creates a controller instance to handle the request.
- The controller creates an action instance and performs the filters for the action.
- If any filter fails, the action is cancelled.
- If all filters pass, the action is executed.
- The action loads a data model, possibly from a database.
- The action renders a view, providing it with the data model.
- The rendered result is returned to the response application component.
- The response component sends the rendered result to the user's browser.
The following diagram shows how an application handles a request.
In this section, we will describe in detail how some of these steps work.
Kiến trúc ứng dụng (Application Structure): Phần mở rộng (Extensions)