Yii2 自定义生成器 for gii

安装: 123

依赖项: 0

建议者: 0

安全: 0

星星: 2

关注者: 3

分支: 1

类型:yii2-extension

2.0.5 2017-12-07 07:32 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:42:08 UTC


README

它添加了主题生成器和新的 CRUD 模板。它基于 yiisoft/yii2-gii

安装

安装此扩展的首选方式是通过 composer

运行以下命令

php composer.phar require-dev myzero1/yii2-gii-plus:1.*

或者在您的 composer.json 文件的 require-dev 部分添加以下内容:

"myzero1/yii2-gii-plus": "~1.0.0"

设置

扩展安装完成后,只需按照以下方式修改您的应用程序配置:

...
if (!YII_ENV_TEST) {
    $config['bootstrap'][] = 'myzero1';
    $config['modules']['myzero1'] = [
        'class' => 'myzero1\yii2giiplus\Module',
        'allowedIPs' => ['*'],
        // 'generators' => [
        //     'myzero1_mvc' => ['class' => 'myzero1\yii2giiplus\generators\mvc\Generator'],
        //     'myzero1_crud' => [
        //         'class' => 'myzero1\yii2giiplus\generators\crud\Generator',
        //         'templates' => [
        //             'adminlte' => '@myzero1/gii/generators/theming/default/adminlte/_gii_templates/crud',
        //         ],
        //         'template' => 'adminlte',
        //         'messageCategory' => 'backend'
        //     ],
        // ]
    ];
}

用法

您可以通过以下 URL 访问 Gii:

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

或者如果您已启用漂亮 URL,您也可以使用以下 URL:

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