ayaresko / yii2-extended-gii
支持Twig的Yii框架Gii扩展
2.0.1
2016-03-21 11:18 UTC
Requires
- bower-asset/typeahead.js: 0.10.* | ~0.11.0
- phpspec/php-diff: >=1.0.2
- yiisoft/yii2: >=2.0.4
- yiisoft/yii2-bootstrap: ~2.0
This package is not auto-updated.
Last update: 2024-09-14 18:47:27 UTC
README
本扩展为Yii框架2.0应用程序提供了一个基于Web的代码生成器,称为Gii。您可以使用Gii快速生成模型、表单、模块、CRUD等。
有关许可证信息,请查看LICENSE文件。
文档位于docs/guide/README.md。
安装
安装此扩展的首选方式是通过composer。
运行以下命令:
php composer.phar require --dev --prefer-dist aayaresko/yii2-extended-gii
或将以下内容添加到您的composer.json
文件的require-dev部分:
"aayaresko/yii2-extended-gii": "~2.0.0"
用法
扩展安装后,只需按如下方式修改您的应用程序配置:
return [ 'bootstrap' => ['gii'], 'modules' => [ 'gii' => [ 'class' => 'aayaresko\gii\Module', ], // ... ], // ... ];
return [ 'view' => [ 'renderers' => [ 'twig' => [ 'class' => '\yii\twig\ViewRenderer', 'cachePath' => '@runtime/twig/cache', 'options' => YII_DEBUG ? [ 'debug' => true, 'auto_reload' => true, ] : [], 'extensions' => YII_DEBUG ? [ '\Twig_Extension_Debug', ] : [], 'globals' => [ 'html' => '\yii\helpers\Html', ], 'functions' => [ 'translate' => '\Yii::t', ], 'uses' => [ 'yii\bootstrap' ], ] ] ] ]
您可以通过以下URL访问Gii:
https:///path/to/index.php?r=gii
如果已启用美观URL,您也可以使用以下URL:
https:///path/to/index.php/gii
对于控制台应用程序,使用相同的配置,您也可以通过以下命令行访问Gii:
# 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