Take the Tour

Yii was designed with building Web applications in-mind. Here’s a very brief overview of the Yii development process for creating a database-driven Web application.

Step 0. Preparation

After downloading and installing the Yii framework, run a simple console command to generate a skeleton Web application built with Yii. The application is fully functional, with nice features including user login and contact form. It is a good starting point for implementing more sophisticated features.

Step 1. You Create the Database

While Yii can virtually eliminate most repetitive coding tasks, you are responsible for the real creative work. This often starts with designing the whole system to be built, in terms of some database schema.

Step 2a. Yii Generates the Model Classes

Now it is Yii's turn to transform your database schema into functional PHP code. Using the built-in Web-based code generator, you can turn database table definitions into model classes instantly, without writing a single line of code. The model classes will allow you to access the database tables in an object-oriented fashion.

Step 2b. Yii Generates the CRUD Code

Using the aforementioned code generator, you can further generate code that implements the typical CRUD (create, read, update, delete) features for the selected database tables. The generated code is highly usable and customizable, following the well-adopted MVC (model-view-controller) design pattern. Again, Yii does all the dirty work without requiring you to write a single line of code.

Step 3. You customize the code to fit your exact needs

Finally you need to customize the code to fit your exact needs. For example, to hide the password column on the user administration page, simply cross out the 'password' element shown in the following user admin view file:

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'user-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        'id', 'username',
        'password',
        'email', array('class'=>'CButtonColumn'),
))); ?>

Where to Go from Here?

The above tour is only a brief glimpse into the wonderful world of Yii. And it is hardly even the tip of the iceberg.

The next obvious steps are for you to download Yii, go through a proper tutorial or two, and join in on the fun.

Enjoy!