Content of the «Application Structure» section:
- Application Structure Overview
- Entry Scripts
- Application Components
Articles section «Application Structure»:
Extensions are redistributable software packages specifically designed to be used in Yii applications and provide ready-to-use features. For example, the yiisoft/yii2-debug extension adds a handy debug toolbar at the bottom of every page in your application to help you more easily grasp how the pages are generated. You can use extensions to accelerate your development process. You can also package your code as extensions to share with other people your great work.
Widgets are reusable building blocks used in views to create complex and configurable user interface elements in an object-oriented fashion. For example, a date picker widget may generate a fancy date picker that allows users to pick a date as their input. All you need to do is just to insert the code in a view like the following:
Filters are objects that run before and/or after controller actions. For example, an access control filter may run before actions to ensure that they are allowed to be accessed by particular end users; a content compression filter may run after actions to compress the response content before sending them out to end users.
Modules are self-contained software units that consist of models, views, controllers, and other supporting components. End users can access the controllers of a module when it is installed in application. For these reasons, modules are often viewed as mini-applications. Modules differ from applications in that modules cannot be deployed alone and must reside within applications.
Views are part of the MVC architecture. They are code responsible for presenting data to end users. In a Web application, views are usually created in terms of view templates which are PHP script files containing mainly HTML code and presentational PHP code. They are managed by the [[yii\web\View|view]] application component which provides commonly used methods to facilitate view composition and rendering. For simplicity, we often call view templates or view template files as views.
Models are part of the MVC architecture. They are objects representing business data, rules and logic.
You can create model classes by extending [[yii\base\Model]] or its child classes. The base class [[yii\base\Model]] supports many useful features:
Controllers are part of the MVC architecture. They are objects of classes extending from [[yii\base\Controller]] and are responsible for processing requests and generating responses. In particular, after taking over the control from applications, controllers will analyze incoming request data, pass them to models, inject model results into views, and finally generate outgoing responses.
Applications are service locators. They host a set of the so-called application components that provide different services for processing requests. For example, the
urlManager component is responsible for routing Web requests to appropriate controllers; the
db component provides DB-related services; and so on.