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.



Application Components Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Application Components

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.

Applications Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Applications

Applications are objects that govern the overall structure and lifecycle of Yii application systems. Each Yii application system contains a single application object which is created in the entry script and is globally accessible through the expression \Yii::$app.

Yii 2 Entry Scripts
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Entry Scripts

Entry scripts are the first step in the application bootstrapping process. An application (either Web application or console application) has a single entry script. End users make requests to entry scripts which instantiate application instances and forward the requests to them.

Entry scripts for Web applications must be stored under Web accessible directories so that they can be accessed by end users. They are often named as index.php, but can also use any other names, provided Web servers can locate them.

Overview Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Overview

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.

Looking Ahead Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Looking Ahead

If you've read through the entire "Getting Started" chapter, you have now created a complete Yii application. In the process, you have learned how to implement some commonly needed features, such as getting data from users via an HTML form, fetching data from a database, and displaying data in a paginated fashion. You have also learned how to use Gii to generate code automatically. Using Gii for code generation turns the bulk of your Web development process into a task as simple as just filling out some forms.

Yii 2. Generating Code with Gii
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Generating Code with Gii

This section will describe how to use Gii to automatically generate code that implements some common Web site features. Using Gii to auto-generate code is simply a matter of entering the right information per the instructions shown on the Gii Web pages.

Subcategories