Commit 89626899 by Alexander Makarov

Adjusted Gii guide to mention a bit different config structure of a basic application

parent ed7b7db8
...@@ -8,7 +8,8 @@ as well as complete CRUD controllers. ...@@ -8,7 +8,8 @@ as well as complete CRUD controllers.
Installing and configuring Installing and configuring
-------------------------- --------------------------
Gii comes as an offical extension and the preferred way to install this extension is through [composer](http://getcomposer.org/download/). Gii comes as an offical extension and the preferred way to install this extension is through
[composer](http://getcomposer.org/download/).
Either run Either run
...@@ -42,13 +43,44 @@ http://localhost/path/to/index.php?r=gii ...@@ -42,13 +43,44 @@ http://localhost/path/to/index.php?r=gii
> Note: if you are accessing gii from another IP than localhost, access will be denied by default. > Note: if you are accessing gii from another IP than localhost, access will be denied by default.
You have to add allowed IPs to the configuration in this case: You have to add allowed IPs to the configuration in this case:
```php
'gii' => [ ```php
'gii' => [
'class' => 'yii\gii\Module', 'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs 'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'] // adjust this to your needs
], ],
``` ```
### Basic application
In basic application template configuration structure is a bit different so Gii should be configured in
`config/web.php`:
```php
// ...
if (YII_ENV_DEV)
{
// configuration adjustments for 'dev' environment
$config['preload'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['modules']['gii'] = 'yii\gii\Module'; // <--- here
}
```
So in order to adjust IP address you need to do it like the following:
```php
if (YII_ENV_DEV)
{
// configuration adjustments for 'dev' environment
$config['preload'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.178.20'],
];
}
```
How to use it How to use it
------------- -------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment