The Gii extension for the Yii framework

Installs: 3 520

Dependents: 3

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 1

Open Issues: 2

Type:yii2-extension

dev-main / 1.0.x-dev 2024-01-22 09:33 UTC

This package is auto-updated.

Last update: 2024-04-30 10:36:58 UTC


README

68747470733a2f2f7777772e7969696672616d65776f726b2e636f6d2f696d6167652f7969695f6c6f676f5f6c696768742e737667

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.