Gii ModelDoc Generator for Yii framework

Installs: 11 758

Dependents: 0

Stars: 13

Watchers: 4

Forks: 2

Open Issues: 2

1.2.6 2014-10-12 08:26 UTC


ModelDoc Generator will extend Gii allowing an update to existing models with phpDoc compatible documentation.


  • Table Fields
    • Adds properties for each field.
    • Properties are annotated with field comments from the database.
  • Relations
    • Adds a property with a return type for each relation.
  • CActiveRecord Inheritance
    • Adds methods inherited from CActiveRecord including: find(), findByPk(), findByAttributes(), fndBySql(), findAll(), findAllByPk(), findAllByAttributes(), findAllBySql(), with(), together(), cache(), resetScope(), populateRecord() and populateRecords().
  • Behaviors
    • Adds a property with a return type for each behavior.
    • Adds methods assigned for behaviors, unless it is defined by the model itself.
    • Optionally uses @mixin for behaviors.
  • Scopes
    • Adds a method for each scope.
  • Full Syntax
    • All PHPDoc tags contain full syntax including: method params and return types.
    • All returned models have namespace support.


Listing all the models that are going to have phpDocs inserted: Files

Preview of the model before it gets updated: Preview


Please download using ONE of the following methods:

Composer Installation

All requirements are automatically downloaded into the correct location when using composer. There is no need to download additional files or set paths to third party files.

Get composer:

curl | php

Install latest release OR development version:

php composer.phar require cornernote/gii-modeldoc-generator:*               // latest release
php composer.phar require cornernote/gii-modeldoc-generator:dev-master  // development version

Add the vendor folder to the aliases in your yii configuration:

Manual Installation

Download the latest release or development version and move the gii-modeldoc-generator folder into your protected/modules folder.


Add the path to gii-modeldoc-generator to the generatorPaths in your gii configuration:

return array(
    'modules' => array(
        'gii' => array(
            'generatorPaths' => array(
                // use this if you installed with composer

                // OR, use this if you downloaded into your extensions folder


Ensure you have --- BEGIN ModelDoc --- and --- END ModelDoc --- in each of your models, for example:

 * Your class description that will not be altered by ModelDoc
 * --- BEGIN ModelDoc ---
 *  this section will be replaced by ModelDoc
 * --- END ModelDoc ---
class MyModel extends CActiveRecord { ... }

Visit index.php?r=gii, then choose ModelDoc from the menu.


This extension will not create any new model files. You should first create them or generate them with a model generator.




BSD-3-Clause, Copyright © 2013-2014 Mr PHP

Mr PHP Project Stats

Latest Stable Version Total Downloads Monthly Downloads Latest Unstable Version Build Status License