Yii 1.1: giix

giix is gii Extended, a code generator for Yii PHP framework.


giix is gii Extended, a code generator for Yii PHP framework.

giix is inspired and based on gii-template-collection (gtc), by Herbert Maschke (thyseus).

giix is free software and is dual-licensed under the terms of the new BSD License and under the terms of GNU GPL v3. See the LICENSE file.


Forum discussion for giix
giix on GitHub

Watch giix on GitHub Fork giix on GitHub

Starting with Yii? Read The complete beginner's study guide for the Yii Framework

Latest news

giix 1.9.2 is here. It adds out-of-the-box support for giic.


giix is inspired and uses code from Yii PHP framework and gii-template-collection. Many thanks to Qiang Xue, Herbert Maschke and the contributors of these software.


giix extends Yii's gii by providing:

  • Proper handling of related model attributes, rendering appropriate form fields based on relation type.
  • More support for HAS_MANY and MANY_MANY relations.
  • Native support for saving MANY_MANY relations with the new method GxActiveRecord::saveWithRelated.
  • Native support for saving multiple (related or not) records with the new method GxActiveRecord::saveMultiple (this method has known bugs, avoid using it).
  • Automatic string representation for a model via GxActiveRecord::representingColumn() and GxActiveRecord::__toString().
  • Better i18n support and easier to maintain: support to active record labels. You change the label once in the model and it is automatically updated in the views. This is especially useful for plurals.
  • Out-of-the box i18n support by using Yii::t().
  • Appropriate form fields are rendered based on model attribute/table field data type.
  • Separated model and basemodel. Basemodel can be regenerated without overwriting your code in the model.
  • Smart methods can query your database for just the needed data (usually the primary key and the field with the string representantion), avoiding manual setup or a "select *".
  • Extensive use of default method parameters. Appropriate data is found automatically.
  • Some (incipient) support for tables with composite primary keys.
  • Generated code is completely free from styling and formatting. Your CSS controls the presentation.
  • Generated code is (almost) free of comments.
  • Well documented and commented source code. Ohloh says that 40% of the lines in the code are comments! You can understand and modify anything you want.

And a lot more! Read the CHANGELOG file and the (richly commented) source code to fully leverage giix's power.

Some of these features come from gtc.


giix is not fully tested now, so please test your application and be careful using it.
giix is still in development. Some changes may break backwards compatibility.

Are you upgrading? Please don't forget to read the UPGRADE file for instructions!

Some users reported problems extracting the files from the archive.
Please download the free 7-zip version 9.20, it is reported to work well.

Installation and upgrading

Please see INSTALL and UPGRADE files for instructions.

Please check the README file for more information.

Related wiki pages

Extensions based on/for or related to giix

  • giix-haml: Extends the giix extension adding Haml templates and more.
  • e-xgen: extjs crud generator.
  • manymanyajaxcrudadmin: giix templates for ajax CRUD code generation of a MANY_MANY Model relationship.
  • foundation4giix: Templates for using Foundation 4 with Yii and optional giix templates if you're a giix fan.
  • giic: Toolset for running Gii (and giix) on the command line.
  • monthpicker: Yii extension wrapping the jQuery UI Monthpicker Widget from Julien Poumailloux (with giix integration).

Apps powered by giix


Already using giix?

Show the love! Show how you love giix on the forum and on this extension page
Upvote! Upvote giix

Made in Brazil Made in Brazil by mentel (Rodrigo Coelho)

Icons by famfamfam.com

Total 20 comments

#19969 report it
Rahmad Subekti at 2016/10/31 10:37pm
Fail to try it

Sorry if I so late to read it and give the comment. But I hope anyone could help me to fix my problem. I downloaded giix extension. I have followed the tutorial above. But I don't know why it doesn't work. When I compiled it, the browser display CException that said : CActiveForm and its behaviors do not have a method or closure named "enumDropDownList". Please, anyone could help me ? because this project very important to me. Thank you

#19937 report it
checkmate at 2016/08/26 07:03am
seconding bryglen suggestion

please can you write a tutorial concerning how to overide the methods, am currently experiencing problem with rules() in model right now although i already submit a help on the forum

thanks for the extension

#19469 report it
xNicox at 2015/07/17 08:43am
Giix Crud Generator Error (1.9.2)

Hi, I downloaded last Giix tools, i've allready used in another proyects, but not this version.

I have an error when I try to use Crud Generator (Model Works fine), the problem is that page stop loading when starttin widget "zii.widgets.jui.CJuiAutoComplete", aprox on line 26-27.

I comment that line and add this before: <?php echo $form->textField($model,'model', array('size'=>65)); ?>

It looks like a problem with the parms to the widget.

If I turn on the log, I see that the last entry is loading that widget ... and nothing more.

Any Idea ?

PS: I check that page encondig is "utf-8 w/o BOM" and windows. Best Regards

#18800 report it
schmunk at 2015/01/10 12:06pm

I am working on a similar project for Yii2 called giiant... you may have a look.

#18793 report it
nye.cat at 2015/01/09 08:08pm


Are you planning to upgrade giix to work in yii2?


#17794 report it
rashmani at 2014/07/23 03:08am
Separated Controller and Giix version

Hi there!

First of all thanks for Giix, unvaluable, also as learning tool.

@Diego Felix: what you can do is to separate Controller's Actions, possibly sharing Actions amongst controllers thus improving code reusability. Fundamentals are here: http://www.yiiframework.com/doc/guide/1.1/en/basics.controller#action. Pay attention when you need to call Controller's methods from your Action, you may need to execute this before:

// get controller
        $controller = $this->getController();

@Rodrigo: is there any chance to have an easy way to get Giix running version? Something like displaying it in generator pages... I haven't update Giix in a long time and found myself naked when looking for current installed version... Apart from this, great job whatsoever!


#16691 report it
yanhui at 2014/03/19 10:11pm

Yes, it saved me a lot of time, too. Thank you Rodrigo Coelho and all the contributors!

#16439 report it
Diego Felix at 2014/02/23 08:28am
separated controller and basecontroller

Does anyone knows an implementation of a separeted controller and basecontroller like to the model in giix:

  • Separated model and basemodel. Basemodel can be regenerated without overwriting your code in the model.

anyone knows?

#15536 report it
Hesam at 2013/11/19 10:48am
GxController extends Controller

I use yiiinitializer and I installed Gix. After crud creation, I've got an error that it cannot include controller.php, so I have to change the above line to GxController extends CController.

#14981 report it
Rafalsky.com at 2013/09/26 04:13am
You have an error in code

You have an error in code in method GxActiveRecord::saveMultiple();

You try to start transaction by this: $this->getDbConnection()->beginTransaction()

But this is a static method so variable $this is not declared :)

#14287 report it
Rodrigo Coelho at 2013/08/01 09:53pm

Great idea! I'll take a look at it.

#14285 report it
schmunk at 2013/08/01 06:02pm
Toolset for running Gii on the command line


I've just released giic to run Gii on the command line. See the README for infos about running giix generators with it.

Best regards, schmunk

#14113 report it
Elecen at 2013/07/19 09:14pm
Bug in saveMultiple

Hi guys, just installed and about to start using Giix again (after a looong time), really nice job by the way. I noticed in the GxActiveRecord class the saveMultiple function is static and in the function I see a lot of $this->....

If I get the chance to fix it I'll send a patch.

Awesome job, keep it going! xD

#13199 report it
fleuryc at 2013/05/13 09:51am
MANY MANY relation with data


Just a question : can I use saveWithRelated for a MANY_MANY relation with data. For instance :

Person(int id)-Seen(int id_person,int id_movie,date date,bool liked)-Movie(int id)

Can I use saveWithRelated to save one person with all the movies he has seen and the relation data (date and liked wich cannot be null)?

If not, how to do it nicely?


#12994 report it
eholsinger at 2013/04/26 12:47pm
use extensionPaths not extensionBasePaths

For "Property "CPhpMessageSource.extensionBasePaths" is not defined.", there is no property "extensionBasePaths", based on yii-1.1.13.e9e4a0, framework/i18n/CPhpMessageSource.php:

     * @var array the message paths for extensions that do not have a base class to use as category prefix.
     * The format of the array should be:
     * <pre>
     * array(
     *     'ExtensionName' => 'ext.ExtensionName.messages',
     * )
     * </pre>
     * Where the key is the name of the extension and the value is the alias to the path
     * of the "messages" subdirectory of the extension.
     * When using Yii::t() to translate an extension message, the category name should be
     * set as 'ExtensionName.categoryName'.
     * Defaults to an empty array, meaning no extensions registered.
     * @since 1.1.13
    public $extensionPaths=array();

so the config should actually be

'messages' => array (
      // Pending on core: http://code.google.com/p/yii/issues/detail?id=2624
      'extensionPaths' => array(
        'giix' => 'ext.giix.messages', // giix messages directory.

This might have solved @evan108108's issue. Hopefully it can help someone else.

#11784 report it
bryglen at 2013/02/03 10:19pm

Thanks for your codes.

like I've said many people don't know how to used giix properly :)

I've still seen a lot of people don't know how to override and inherit and it's great if you put it on your extension.

#11757 report it
Luiz at 2013/02/01 10:13pm
Merging BaseModel and Model configurations

@bryglen, I never change the BaseClass.

I generate constantly new BaseClasses and I almost never lose the settings of the child classes. Of course I always do a basic review. To this I do a merge (CMap::mergeArray()) of the corresponding function of the parent class to the child class.

See this example, I have an UserBase.php (intact ) and my User.php:

class User extends UserBase{
    public static function model($className = __CLASS__)
        return parent::model($className);
    public function relations()
        return CMap::mergeArray(parent::relations(),
                'organizations' => array(self::MANY_MANY, 'Organization','user_organization(user_id, organization_id)'),

In case of conflict you can remove an entry from the BaseModel without editing it using the function array_diff():

public function rules()
        return CMap::mergeArray(array_diff(
                   array('name, password, password_strategy, email, create_time', 'required'),
                array('name, password, email', 'required', 'message' => Yii::t('validation', 'Please insert your {attribute}.')),
                array('password_strategy, create_time', 'message' => Yii::t('validation', '{attribute} are null!')),

This code remove the rule from parent rules function:

array('name, password, password_strategy, email, create_time', 'required')

That way I avoid the conflict of two messages appear for the same validation error.

Hope this help

#11339 report it
bryglen at 2013/01/07 03:02am
Hi Rodrigo. Suggestion regarding giix.

Can you add a tutorial how people will override and inherit without modifying the BaseClass

I've still seen a lot of people don't know how to override and inherit and it's great if you put it on your extension.

#10965 report it
cappadochian at 2012/12/06 08:27pm
Property "GiixModelCode.relations" is read only.

by model generation.

Source File


00067: $this->relations = $this->generateRelations();

what have I done wrong...?


#10945 report it
Athos at 2012/12/05 08:28pm
A quick way to select only the changed Base classes
checkBaseOverwrite = function() {
    $(\"table.preview\").find('input').attr('checked', false);
    $(\"tr.overwrite:contains('\_base\')\").css('background-color', '#faa').find('input').attr('checked', true);
xcheckBaseOverwrite = $('<a href=\"javascript:void(0)\" onClick=\"checkBaseOverwrite()\">Base Overwrite</a>');

Leave a comment

Please to leave your comment.

Create extension