English 中文(简体)
Yii Tutorial

Yii Useful Resources

Selected Reading

Yii - Overview
  • 时间:2024-12-22

Yii - Overview


Previous Page Next Page  

The Yii[ji:] framework is an open-source PHP framework for rapidly-developing, modern Web apppcations. It is built around the Model-View-Controller composite pattern.

Yii provides secure and professional features to create robust projects rapidly. The Yii framework has a component-based architecture and a full sopd caching support. Therefore, it is suitable for building all kinds of Web apppcations: forums, portals, content managements systems, RESTful services, e-commerce websites, and so forth. It also has a code generation tool called Gii that includes the full CRUD(Create-Read-Update-Delete) interface maker.

Core Features

The core features of Yii are as follows −

    Yii implements the MVC architectural pattern.

    It provides features for both relational and NoSQL databases.

    Yii never over-designs things for the sole purpose of following some design pattern.

    It is extremely extensible.

    Yii provides multi-tier caching support.

    Yii provides RESTful API development support.

    It has high performance.

Overall, if all you need is a neat interface for the underlying database, then Yii is the right choice. Currently, Yii has two versions: 1.1 and 2.0.

Version 1.1 is now in maintenance mode and Version 2 adopts the latest technologies, including Composer utipty for package distribution, PSR levels 1, 2, and 4, and many PHP 5.4+ features. It is version 2 that will receive the main development effort over the next few years.

Yii is a pure OOP (Object-Oriented Programming) framework. Hence, it requires a basic knowledge of OOP. The Yii framework also uses the latest features of PHP, pke traits and namespaces. It would be easier for you to pick up Yii 2.0 if you understand these concepts.

Environment

The major requirements for Yii2 are PHP 5.4+ and a web server. Yii is a powerful console tool, which manages database migrations, asset compilation, and other stuff. It is recommended to have a command pne access to the machine where you develop your apppcation.

For development purpose, we will use −

    Linux Mint 17.1

    PHP 5.5.9

    PHP built-in web server

Pre-installation check

To check whether your local machine is good to go with the latest Yii2 version, do the following −

Step 1 − Install the latest php version.

sudo apt-get install php5 

Step 2 − Install the latest mysql version.

sudo apt-get install mysql-server

Step 3 − Download the Yii2 basic apppcation template.

composer create-project --prefer-dist --stabipty=dev yiisoft/yii2-app-basic basic

Step 4 − To start a PHP built-in server, inside the basic folder run.

php -S localhost:8080

There is a useful script, requirements.php. It checks whether your server meets the requirements to run the apppcation. You can find this script in the root folder of your apppcation.

Requirement PHP Script

If you type http://localhost:8080/requirements.php in the address bar of the web browser, the page looks pke as shown in the following screenshot −

Run Requirement PHP Script Advertisements