How you can use Gii in Yii Framework 2.0

Gii is a Web-based code generation tool. Gii is able 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 to the instructions shown on the Gii Web pages.

You can access Gii via the following URL:

http://localhost/(name of yourproject)/web/index.php?r=gii

In this tutorial I will explain to you how you can generate an ActiveRecord class for the specified database table.

First of all you must create a table in your database. Next, go to http://localhost/(name of yourproject)/web/index.php?r=gii

Click on the Start button where is Model Generator and enter your table name in the Table Name field. Click on Preview and Generate buttons.

And your first model will be created in the models folder.

Video tutorial:

Leave a Comment