schmunk42/yii2-giiant Gii CRUD generator for Yii 2 Framework



"Giiant is huge!"

Build Status

What is this?

Giiant is an extended code-generator for models and CRUDs, based upon Gii (Yii 2.0 Framework).

It creates prototypes for database models and backends including relations defined by foreign-key constrains in no-time.

To provide a highly flexible configuration system it features a callback-provider-queue to define rendering of customized inputs, columns or attribute values.

A main project goal is porting many features and learnings from gtc, giix, awecrud and other code-generators into one solution.



Batch command

  • yii batch creates all models and/or CRUDs for a set of tables sequentially with a single command

Model generator

  • generates separate model classes to customize and base models classes which can be regenerated on schema changes
  • table prefixes can be stripped off model class names (not bound to db connection settings from Yii 2.0)

CRUD generator

  • input, attribute, column and relation customization with provider queues
  • callback provider to inject any kind of code for inputs, attributes and columns via dependency injection
  • virtual-relation support (non-foreign key relations)
  • model, view and controller locations can be customized to use subfolders
  • horizontal and vertical form layout
  • options for tidying generated code
  • action button class customization (Select "App Class" option on the Action Button Class option on CRUD generator to customize)


The preferred way to install this extension is through composer.

Using a stable version

composer require schmunk42/yii2-giiant:"@stable"

Using latest master

composer require schmunk42/yii2-giiant:"@dev"

The generators are registered automatically in the application bootstrap process, if Gii module is enabled.

You can try giiant via phd (dockerized PHP application template).


It's recommended to configure a customized batch command in your application CLI configuration.

'controllerMap' => [
    'batch' => [
        'class' => 'schmunk42\giiant\commands\BatchController',
        'overwrite' => true,
        'modelNamespace' => 'app\\modules\\crud\\models',
        'crudTidyOutput' => true,

Note: yii giiant-batch is an alias for the default configuration of BatchController registered by this extension.

You can add the giiant specific configuration config/giiant.php, and include this from your config/main.php.

See the batches section for configuration details.


To create a full-featured database backend, run the CLI batch command

yii batch

You can still override the settings from the configuration, like selecting specific tables

yii batch --tables=a,list,of,tables

Core commands

Show help for gii

yii help gii

Create application-module for giiant CRUDs

yii gii/giiant-module

The commands for generating models and CRUD, there are usually run via the batch command above.

yii gii/giiant-model
yii gii/giiant-crud


Provider usage and configuration via dependency injection

See docs for details.

Using callbacks to provide code-snippets

See docs for details.


See docs for known-issues, platform specific usage, quirks, faq, ...


Special thanks to motin, thyseus, uldisn and rcoelho for their work, inspirations and feedback.


giiant-0 2-screen-1 giiant-0 2-screen-2

Built by dmstr




  • do not use auto-pluralization in views, pluralize via I18N
  • Improved model generation performance (seemodelCacheRelationsData)
  • updated php-cs-fixer to version 3


  • fixed pivot URLs


  • Added support for modelGenerateJunctionRelationMode
  • Upgraded yiisoft/yii2-gii to version 2.2.0
  • moved JSON form config tog .gii in base directory


  • no changes


  • fixed multi-table json generation table names
  • fixed module labels for json files
  • pager align in GridView
  • changed icons in index view
  • fixed enum values
  • fixed multi-table model json generation


  • generateAccessFilterMigrations option
  • dropdown list in GridView filed search filter optimization
  • select position ActionColumn in GridView (left or right)
  • fix view icon in ActionColumn
  • pager align in GridView


  • added dropdown list in GridView filed search filter
  • allow usage with yiisoft/yii2-gii:^2.1


  • fixed error with php 7.3
  • Correct message category for view action button


  • add baseClassPrefix to model generator.


  • typo of class_exists


  • Update SaveForm.php
  • Additional validation
  • removes reprecated yii2-codeception package deps
  • Update
  • fixed path


  • Fix singularEntities not working when using cli


  • Fix XSS Vulnerability in CRUD views generated


  • Close DB after each model generation
  • added test form view, fixes #230
  • updated docs


  • added tables & skipTables check, refactored skipTables to run in beforeAction
  • Fix #196
  • update for skip db tables


  • added "formLayout" property


  • updated Object to BaseObject, fixes #220
  • updated dependencies
  • fixed phptidy usage
  • updated yii2-gii constraint to ~2.0.6


  • applied fixes from #197
  • Fixed spacing in model extended template.
  • updated example database image
  • updated db-test image
  • refactored paths; added missing dependency
  • added legacy yii2-codeception dependency
  • removed generated tester classes
  • refactoring tests
  • specify DB connection component in generated model, if using non-default 'db' (feature of yii2-gii 2.0.0)
  • include modelGenerateRelation attribute into BatchController
  • include attributes for model-generator's timestampBehavior and blameableBehavior into BatchController
  • get has_one relations as tab in model view
  • if no types to filter are given to ModelTrait::getModelRelations (like in generators/crud/default/views/index.php) we should return all types.
  • use relation property instead of relation getter to avoid multiple db queries.
  • moved messages in ‚yii‘ catalog to ‚crud‘ and ‚giiant‘
  • Fix broken URLs on crud relations
  • Fix CallbackProvider examples
  • improved detection of text columns
  • Fixed namespaces in documentation about providers
  • Merge branch 'master' into feature/fix-relation-detection
  • fixed relation detection
  • updated page titles & form-layout


  • updated constraint to allow phptidy on PHP 7
  • updated CLI command infos
  • fixed bootstrap alert class


  • improved detection of database text columns in callbacks
  • fixed #191
  • added basic NOSQL support (tested with elasticsearch)



  • added color column example
  • apply cutom model name in UI giiant
  • added icons, relation buttons
  • wrap action column buttons in div
  • enable tidyOuput in batch controller by default
  • generate Access Filter Migrations #179
  • do not overwrite search model class by default; added parameter
  • splitted providers into core and extension providers, getCoreProviders should return core providers only
  • removed hardcoded layout from grid, use DI to configure grid
  • added static callback functions for field and column
  • removed logic from model-extended template, see also #170
  • added kartik gridview to modules in test config
  • updated tests


  • added catalogue for model related translations to CRUD generator


  • fixed missing spaces in headlines
  • fixed #141 - removed dependency to dmstr\helpers\Html
  • fixed crud/default/view template, create new related record link param
  • fixed #162
  • added empty merge-with-parent methods for model
  • added separate message categories for model and cruds (batch controller)
  • added route param to permission check - see also
  • added parameter to enable access filter migrations
  • added parameter for controller base traits


  • fixed crud/default/view template, create new related record link param


  • fixed $actionColumnTemplateString in crud default view index.php


  • fixes for message catalogue / translatables
  • SavedForms fix


  • added mission option $useTimestampBehavior, default is true to control the use of yii\behaviors\Timestampbehavior in CLI BatchController for model generation


  • added giiant-extension generator
  • :warning: removed getAliasModel()
  • updated module template
  • fixed form/cli validations


  • fixed copy button


see git log

0.6.1 (2015-12-28)

  • improved test stack isolation
  • fixed and improved tests in CI
  • added access control to REST controller

0.6.0 (2015-12-26)

  • added separate style for default controller (giiant module index view)
  • added upgrading info
  • updated requirements
  • updated dockerized potemkin testing
  • added build message, fixed ENV handling
  • fixed php image version in testing stack
  • Merge pull request #128 from sebathi/master
  • fixed #118
  • added gitlab-ci config
  • Merge pull request #126 from pawelryznar/patch-1
  • create search model directory in batch command
  • fixed model namespace errors; added test generator to module bootstrapping
  • added cmrcx/phptidy dependency
  • removed panel class from views to allow better customization
  • fixed error, when extended controller class contained contents of the base controller
  • fixed #123
  • Merge pull request #119 from gradosevic/master
  • Merge pull request #124 from christophmuth94/master
  • fixed crudProviders paths
  • updated provider example
  • updated installation instructions
  • Added unit tests for GiiantFaker class
  • Implemented crud unit test generator. fixed issue on search model
  • added copy button for records
  • fixed flash messages - use add instead of set (do not overwrite)
  • added phptidy output option
  • fixed detection for database from DI-container
  • flush logs after every loop in batch
  • Merge pull request #117 from christophmuth94/master
  • Editor Provider updated
  • don't skip virtualAttributes by default, added property to change behavior
  • removed legacy code
  • added overwrite check for api controller
  • updated docs
  • added controller namespace property
  • refactored CRUD controllers - split into Controller and BaseController - added REST-ActiveController
  • updated tag for crud navigation buttons - using div, since <ul,ol>s are not allowed inside


GitHub Stars
GitHub Forks



1.0.0 is the latest of 54 releases

BSD-3-Clause license
270 github stars & 120 github forks
303 downloads in the last day
8520 downloads in the last 30 days
342289 total downloads