automatically Generate crud code in yii framework

Using Gii

Before we use Gii, the automatic code generator, we need to install it into our code base.

Installing Gii into the application

Run the following command to fetch the required files to use Gii:

$ php composer.phar require --prefer-dist "yiisoft/yii2-gii:*"

The command-line parameter --prefer-dist is used, so we’ll only get the files needed to use Gii, not develop it.

Now we need to wire Gii into our application:

  1. First, as we’re going to use something installed by Composer in our application, we need the autoloader from Composer. It’s located as a file called autoload.php under the vendor subdirectory. The require call should be placed inside the entry point of our application in the web/index.php file:
    define('YII_DEBUG', true);
    require(__DIR__ ...

About the author

Deven Rathore

I'm Deven Rathore, a multidisciplinary & self-taught designer with 3 years of experience. I'm passionate about technology, music, coffee, traveling and everything visually stimulating. Constantly learning and experiencing new things.

Get The best In Web dev

Get The best In Web dev

Join dunebook and recieve best in Angular, React, Vue, Python, Java & more. Directly to your inbox once a week FREE !

You have Successfully Subscribed!

Pin It on Pinterest