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.
- Getting Started
- Application Structure
- Handling Requests
- Key Concepts
- Working with Databases
- Getting Data from Users
- Displaying Data
- RESTful Web Services
- Development Tools
- Special Topics
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 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
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.
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.
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.
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.
Introduction Article Count: 2
Getting Started Article Count: 8
Application Structure Article Count: 12
Handling Requests Article Count: 8
Key Concepts Article Count: 9
Working with Databases Article Count: 8
Getting Data from Users Article Count: 6
Displaying Data Article Count: 7
Security Article Count: 7
Caching Article Count: 2
Page 10 of 12