Skip to content

yii2-extensions/gii

Repository files navigation

Gii.

php-version yii2-version PHPUnit Codecov

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --dev --prefer-dist yii2-extensions/gii

or add

"yii2-extensions/gii": "dev-main"

to the require-dev section of your composer.json file.

Usage

Once the extension is installed, simply modify your application configuration as follows:

return [
    'bootstrap' => ['gii'],
    'modules' => [
        'gii' => [
            'class' => 'yii\gii\Module',
        ],
        // ...
    ],
    // ...
];

You can then access Gii through the following URL:

http://localhost/path/to/index.php?r=gii

or if you have enabled pretty URLs, you may use the following URL:

http://localhost/path/to/index.php/gii

Using the same configuration for your console application, you will also be able to access Gii via command line as follows,

# change path to your application's base path
cd path/to/AppBasePath

# show help information about Gii
yii help gii

# show help information about the model generator in Gii
yii help gii/model

# generate City model from city table
yii gii/model --tableName=city --modelClass=City

Configure with yiisoft/config

Add the following code to your config/config-plugin file in your application.

'config-plugin' => [
    'web' => [
        '$yii2-gii', // add this line
        'web/*.php'
    ],
],

For activate the gii generator, add in your config/params.php file in your application.

return [
    'yii2.gii' => true,
];

For change allowed IPs, add in your config/params.php file in your application.

return [
    'yii2.gii.allowedIPs' => ['192.168.1.1'],
];

For class map module, add in your config/params.php file in your application.

use App\YourClass;

return [
    'yii2.gii.classMap' => [
        'class' => YourClass::class,
    ],
];

Testing

Check the documentation testing to learn about testing.

Quality code

static-analysis phpstan-level StyleCI

Support versions Yii2

Yii20 Yii22

Our social networks

Twitter

License

The MIT License. Please see License File for more information.

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •