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.



Sessions and Cookies in Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Sessions and Cookies

Sessions and cookies allow data to be persisted across multiple user requests. In plain PHP you may access them through the global variables $_SESSION and $_COOKIE, respectively. Yii encapsulates sessions and cookies as objects and thus allows you to access them in an object-oriented fashion with additional useful enhancements.

Responses Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Responses

When an application finishes handling a request, it generates a [[yii\web\Response|response]] object and sends it to the end user. The response object contains information such as the HTTP status code, HTTP headers and body. The ultimate goal of Web application development is essentially to build such response objects upon various requests.

Yii 2 Requests
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Requests

Requests made to an application are represented in terms of [[yii\web\Request]] objects which provide information such as request parameters, HTTP headers, cookies, etc. For a given request, you can get access to the corresponding request object via the request application component which is an instance of [[yii\web\Request]], by default. In this section, we will describe how you can make use of this component in your applications.

Routing and URL Creation in Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Routing and URL Creation

When a Yii application starts processing a requested URL, the first step it takes is to parse the URL into a route. The route is then used to instantiate the corresponding controller action to handle the request. This whole process is called routing.

The reverse process of routing is called URL creation, which creates a URL from a given route and the associated query parameters. When the created URL is later requested, the routing process can resolve it back into the original route and query parameters.

Bootstrapping Yii 2
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Bootstrapping

Bootstrapping refers to the process of preparing the environment before an application starts to resolve and process an incoming request. Bootstrapping is done in two places: the entry script and the application.

Request Handling Overview Yii 2.0
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Overview

Each time when a Yii application handles a request, it undergoes a similar workflow.

Subcategories