The Definitive Guide to Yii 2.0

The Definitive Guide to Yii 2.0

The Definitive Guide to Yii 2.0

This tutorial is released under the Terms of Yii Documentation.

All Rights Reserved.

2014 (c) Yii Software LLC.



Assets in Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Assets

An asset in Yii is a file that may be referenced in a Web page. It can be a CSS file, a JavaScript file, an image or video file, etc. Assets are located in Web-accessible directories and are directly served by Web servers.

Filters Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Filters

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 Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Modules

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 Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Views

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 Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Models

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 Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Controllers

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.

Subcategories