getting Gii to work on Yii 2.0

tareq picture tareq · Apr 16, 2014 · Viewed 33.3k times · Source

i downloaded the advanced template, extracted it and changed the root documents for the back-end and the front-end, but i can't seem to figure out how to get Gii working to perform the crud operations.

there is require and require-dev field in the composer.JSON i included gii in both of them and each one separately with no luck.

i also tried getting the template through composer, and while installing i saw gii as installed, but still could not get it to work.

this is where i got my Yii template: https://github.com/yiisoft/yii2-app-advanced

Answer

girish picture girish · Nov 11, 2014

This is how to get Gii working from a remote server for an advanced setup template.

In the frontend config file. For example:

/frontend/config/main-local.php

Add the following code:

if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii\debug\Module';

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii']=[
      'class' =>  'yii\gii\Module',
      'allowedIPs' => ['*'],
    ];
}

The interesting part is the Gii array which has been modified.