Search code examples
yii2gii

How to access gii using homestead


I am using homestead as my dev environment for my yii2 tutorial and my problem is I cannot configure the lines below to access gii in http://hostname/index.php?r=gii

    'gii' => [
    'class' => 'yii\gii\Module',
    'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] 
],

Solution

  • I have Gii working with this config in conf/web.php

    if (YII_ENV_DEV) {
        // configuration adjustments for 'dev' environment
    
        $config['bootstrap'][] = 'gii';
        $config['modules']['gii'] = [
            'class' => 'yii\gii\Module',
            'allowedIPs' => ['192.168.56.1'],
        ];
    }
    

    Using Yii 2.0.4

    Look for YII_ENV_DEV in the web.php file

    Forgot to mention. If you're using Vagrant, I can share my bootstrap.sh file which creates a Yii2 enviroment from Ubuntu Precise. Not homestead needed at all. Just drop me a note if you need it.