Yii 2.0: yii2-kartikgii

Gii CRUD base on kartik-v extension


Gii CRUD Generator base on kartik-v extension. Save repeatitive works on every new CRUD generated. Below are some of the features:

  • Data grid view are generated using kartik-v/yii2-grid, pjax are use for the grid
  • Detail View are generated using kartik-v/yii2-detail-view, controllers are generated to support edit mode saving and delete in Detail View.
  • _form are generated using kartik-v/yii2-builder, Date/Time/DateTime/TimeStamp column are automatically generated to use DateTimePicker Widget.
  • Using kartik-v/yii2-datecontrol to globalize date format, so date will automatically convert for the display and also for save according to the format you set, for all CRUD generated using this extension.

By using this extension, you no longer have to change your CRUD to using kartik-v extension, everything will be auto generated for you, and you could customize it later if you need.

Thanks for the great kartik-v extension.

For more information about kartik-v extension, please visit kartik-v at Github.

Note: This is the first extension i created, please kindly comment or suggest for better or correct me if im doing anything wrong. Thanks.


The preferred way to install this extension is through composer.

Either run

$ php composer.phar require warrence/yii2-kartikgii "dev-master"

or add

"warrence/yii2-kartikgii": "dev-master"

to the require section of your composer.json file.


//if your gii modules configuration looks like below:
$config['modules']['gii'] = 'yii\gii\Module';
//change it to
$config['modules']['gii']['class'] = 'yii\gii\Module';
//Add this into backend/config/main-local.php
$config['modules']['gii']['generators'] = [
        'kartikgii-crud' => ['class' => 'warrence\kartikgii\crud\Generator'],
//Add 'gridview' into your 'modules' section in backend/config/main.php
'modules' => [
        'gridview' => [
            'class' => 'kartik\grid\Module',
//add modules 'datecontrol' into your 'modules' section in common/config/main 
'modules' => [
        'datecontrol' =>  [
            'class' => 'kartik\datecontrol\Module',
            // format settings for displaying each date attribute
            'displaySettings' => [
                'date' => 'd-m-Y',
                'time' => 'H:i:s A',
                'datetime' => 'd-m-Y H:i:s A',
            // format settings for saving each date attribute
            'saveSettings' => [
                'date' => 'Y-m-d', 
                'time' => 'H:i:s',
                'datetime' => 'Y-m-d H:i:s',
            // automatically use kartik\widgets for each of the above formats
            'autoWidget' => true,


29 May 2014 (Bug fixed)

  • changing comment style // to /* ... */ in the file crud/default/views/index.php line 42. Thanks to @xlbd :)


yii2-kartikgii is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

Total 10 comments

#19501 report it
claudiogg88 at 2015/08/05 03:02pm
bug in yii 2.0.4 Missing argument 1 for yii\db\BaseActiveRecord::getAttributeHint()

Missing argument 1 for yii\db\BaseActiveRecord::getAttributeHint()

in your class warrence\kartikgii\crud\Generator.php method getModelRelations add $skipMethods = [ 'getRelation', 'getBehavior', 'getFirstError', 'getAttribute', 'getAttributeLabel', 'getOldAttribute', 'getAttributeHint', ];

'getAttributeHint' to the array. thanks for your extension!!!

#18709 report it
xtreem at 2014/12/16 05:17am
Unable to install properly

I cant install composer on my system, ive tried out different ways it just doesnt work for whatever reason... so i tried installing manually i got this error: Class warrence\kartikgii\crud\Generator does not exist

#18688 report it
Warrence at 2014/12/12 06:20pm

Thanks @Ariel Braun.

#18361 report it
Ariel Braun at 2014/10/20 08:11am
I fix the documentation comments

Because Netbeans IDE doesn't support the documentation form like this:

 * @var \yii\models\Model $model

I have changed it to:

/* @var $model \yii\models\Model */

Thank you for the development.

#17364 report it
Warrence at 2014/05/29 03:40am
Bug fixed

Hey thanks @xlbd. I have fixed the bug and updated the repo. :).

#17361 report it
xlbd at 2014/05/29 02:27am
About a little bug

Thanks for this usefull extends,i found a little bug and let you know, in the file index.php line 42,the comment symbol "//" is not suitable,because the result of CURD generate in the file index.php is like this:

22    <p>
23       <?php // echo Html::a(Yii::t('app', 'Create {modelClass}', [
24         'modelClass' => 'User',
25         ]), ['create'], ['class' => 'btn btn-success'])  ?>
26    </p>

Only comment the line 23

So I recommend using comment symbols "/* */"

#17357 report it
Warrence at 2014/05/28 01:47pm

Great to know that desis :)

#17355 report it
desis at 2014/05/28 12:06pm
Adding via composer issue

Thanks Warrence for the advice to check 'minimum-stability'. It was set to 'beta' and I changed it to 'dev' and added to my json file (in the require section) and was able to install it successfully.

#17354 report it
Warrence at 2014/05/28 11:29am
Checking the problem

@desis, it could be something to do with minimum stability, i'm very new in composer thingie, i will try to check whats going on here. If anyone know whats going on, please comment, is greatly appreciate.

#17353 report it
desis at 2014/05/28 10:41am
Unable to add via composer

I was trying to install this extension using the first method above but I get the following error after running from the command line:

Problem 1 - Installation request for warrence/yii2-kartikgii dev-master -> satisfiable by warrence/yii2-kartikgii[dev-master]. - warrence/yii2-kartikgii dev-master requires kartik-v/yii2-grid * -> no mat ching package found.

I am guessing that kartik-v/yii2-grid is not correct?

Or am I doing something wrong?

Leave a comment

Please to leave your comment.

Create extension
No downloadable files yet