There is no license information available for the latest version (1.1.0) of this package.

Advanced Gii model generator for Yii2

1.1.0 2014-08-11 11:33 UTC


Generates 2 models classes instead of just one. This is useful if you are frequently re-generating your models from a schema and want to separate model definitions from custom functionality.

For example: table post

  • \common\models\base\Post - contains table meta (relations, property definitions, tableName, rules, attributeLabels)
  • \common\models\Post - is left almost empty for custom functionality


The easiest way to obtain the code is using Composer: just modify your composer.json to add a custom repository (linking to this project) and require the libary.

	"require": {
		"opus-online/yii2-giimodel": "1.1.*"


To add the Gii generator to your project, just add the class \opus\giimodel\Generator as a new generator to your gii module configuration:

'modules' => [
    'gii' => [
        'class' => 'yii\gii\Module',
        'allowedIPs' => ['*'],
        'generators' => [
            'giimodel' => [
                'class' => '\opus\giimodel\Generator',
                'prefixMap' => [
                    'tbl_user_' => 'user',
                    'tbl_' => '',
                    'ext_' => 'sub/dir',


  • Support for Search models
  • Remembering relation/base class names
  • Document namespace override parameters



  • Now possible to group models using prefixes and subfolders
  • Intra-context relation getters shortened


  • Added support for overriding relation class name
  • Fixed issue with preceding slash of relation class namespace
  • Fixed issue where unselected base models still got generated
  • Added generating attribute PHPDoc from SQL field comments
  • Added support for yii2 1.0-beta