PHPackages                             zolotarev/yii2-giiant - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. zolotarev/yii2-giiant

ActiveYii2-extension[Admin Panels](/categories/admin)

zolotarev/yii2-giiant
=====================

Gii CRUD generator for Yii 2 Framework

0.4.1(10y ago)02BSD-3-ClausePHP

Since Dec 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/zolotarev/yii2-giiant)[ Packagist](https://packagist.org/packages/zolotarev/yii2-giiant)[ Docs](https://github.com/schmunk42/yii2-giiant)[ RSS](/packages/zolotarev-yii2-giiant/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (10)Used By (0)

yii2-giiant
===========

[](#yii2-giiant)

Extended models and CRUDs for Gii, the code generator of Yii2 Framework

**PROJECT IS IN BETA STAGE!**

What is it?
-----------

[](#what-is-it)

Giiant provides templates for model and CRUD generation with relation support and a sophisticated UI. A main project goal is porting many features and learnings from gtc, giix, awecrud and others into one solution.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

```
composer.phar require schmunk42/yii2-giiant:"*"

```

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

Usage
-----

[](#usage)

Visit your application's Gii (eg. `index.php?r=gii` and choose one of the generators from the main menu screen.

For basic usage instructions see the [Yii2 Guide section for Gii](http://www.yiiframework.com/doc-2.0/guide-tool-gii.html).

### Command Line Batches

[](#command-line-batches)

You can run batches of base-model and CRUD generation with the build in batch command:

```
./yii giiant-batch --tables=profile,social_account,user,token

```

It will process the given tables, for more details see `./yii help giiant-batch`. See the [Sakila example](docs/generate-sakila-backend.md) for a detailed example.

Features
--------

[](#features)

### Model generator

[](#model-generator)

- generates separate model classes to customize and base models classes to regenerate
- table prefixes can be stipped off model class names (not bound to db connection setting)

### CRUD generator

[](#crud-generator)

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

Providers
---------

[](#providers)

- *CallbackProvider* universal provider to modify any input, attribute or column with highly flexible callback functions
- *RelationProvider* renders code for relations (eg. links, dropdowns)
- *EditorProvider* renders RTE, like `Ckeditor` as input widget
- *DateTimeProvider* renders date inputs
- *OptsProvider* render a populated dropdown, if the model contains and `optsColumnName()` method.

### Customization with providers

[](#customization-with-providers)

In many cases you want to exchange i.e. some inputs with a customized version for your project. Examples for this use-case are editors, file-uploads or choosers, complex input widget with a modal screen, getting data via AJAX and so on.

With Giiant Providers you can create a queue of instances which may provide custom code depending on more complex rules. Take a look at some existing [giiant providers](https://github.com/schmunk42/yii2-giiant/tree/master/crud/providers).

Configure providers, add this to your provider list in the form:

```
\schmunk42\giiant\crud\providers\EditorProvider,
\schmunk42\giiant\crud\providers\SelectProvider,
\schmunk42\giiant\crud\providers\OptsProvider,

```

And configure the settings of the provider, add setting via dependecy injection this to your application config, eg. in `console/config/bootstrap.php`:

```
\Yii::$container->set(
    'schmunk42\giiant\crud\providers\EditorProvider',
    [
        'columnNames' => ['description']
    ]
);

```

This will render a Ckeditor widget for every column named `description`.

```

```

**NOTE** The OptsProvider matches every model with opts methods for a field, i.e. method `optsMembers` matches for model attribute `members`.

#### Using "prompt" in dropdown lists

[](#using-prompt-in-dropdown-lists)

Set the first entry in your `getColumnName()` method to value `null`.

```
null => \Yii::t('app', 'Select'),

```

To ensure that the correct value is written to the database you should add a validation rule in the model.

```
public function rules()
{
    return ArrayHelper::merge(
        parent::rules(),
        [
            [
                ['field_name'],
                'default',
                'value' => null
            ]
        ]
    );
}

```

### Universal `CallbackProvider`

[](#universal-callbackprovider)

This provider has three properties `activeFields` (form), `columnFormats` (index) and `attributeFormats` (view) which all take an array of callback as input. The keys are evaluated as a regular expression the match the class and attribute name. While the callback function takes the current attribute and generator as input parameters.

The configuration can be done via the dependency injection container of Yii2.

Define callbacks for input fields in `_form` view

```
$activeFields = [

   /**
    * Generate a checkbox for specific column (model attribute)
    */
   'models\\\\Foo.isAvailable' => function ($attribute, $generator) {
       $data = \yii\helpers\VarDumper::export([0 => 'Nein', 1 => 'Ja']);
       return checkbox({$data});
INPUT;
   },

];

```

Define callbacks for grid columns in `index` view

```
columnFormats = [

   // generate custom HTML in column
   'common\models\Foo.html' => function ($attribute, $generator) {
       return  'item_id',
    'value'=> function(\$model){
        return \yii\helpers\Html::a(\$model->bar,['/crud/item/view', 'id' => \$model->link_id]);
    }
]
FORMAT;
   },

    // hide all text fields in grid
    '.+' => function ($column, $model) {
            if ($column->dbType == 'text') {
                return false;
            }
    },

    // hide system fields in grid
    'created_at$|updated_at$' => function () {
           return false;
    },

];

```

Detail `view` attributes

```
$attributeFormats = [

    // usa a static helper function for all columns ending with `_json`
    '_json$' => function ($attribute, $generator) {
        $formattter = StringFormatter::className();
        return  '{$attribute->name}',
    'value'=> {$formattter}::contentJsonToHtml(\$model->{$attribute->name})

]
FORMAT;

    },
];

```

Finally add the configuration via DI container

```
\Yii::$container->set(
    'schmunk42\giiant\crud\providers\CallbackProvider',
    [
        'activeFields'  => $activeFields,
        'columnFormats' => $columnFormats,
        'attributeFormats' => $attributeFormats,
    ]
);

```

[More providers...](docs/callback-provider-examples.md)

Use custom generators, model and crud templates
-----------------------------------------------

[](#use-custom-generators-model-and-crud-templates)

```
$config['modules']['gii'] = [
    'class'      => 'yii\gii\Module',
    'allowedIPs' => ['127.0.0.1'],
    'generators' => [
        // generator name
        'giiant-model' => [
            //generator class
            'class'     => 'schmunk42\giiant\model\Generator',
            //setting for out templates
            'templates' => [
                // template name => path to template
                'mymodel' =>
                    '@app/giiTemplates/model/default',
            ]
        ]
    ],
];

```

Extras
------

[](#extras)

A detailed description how to use MySQL workbench for model updates and migration see [here](docs/using-mysql-workbench.md).

Special thanks to [motin](https://github.com/motin), [thyseus](https://github.com/thyseus), [uldisn](https://github.com/uldisn) and [rcoelho](https://github.com/rcoelho) for their work, inspirations and feedback.

Troubleshooting
---------------

[](#troubleshooting)

You can also add

```
"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/schmunk42/yii2-giiant.git"
  }
],
"require": {
    .....(your required modules)....
    "schmunk42/yii2-giiant":"dev-master"
},

```

to your \*\*\* composer.json \*\*\* file and run

```
composer update

```

if you are having trouble with "Not found" errors using the preferred method.

Screenshots
-----------

[](#screenshots)

[![giiant-0 2-screen-1](https://cloud.githubusercontent.com/assets/649031/5692432/c93fd82c-98f5-11e4-8b52-8f35df52986f.png)](https://cloud.githubusercontent.com/assets/649031/5692432/c93fd82c-98f5-11e4-8b52-8f35df52986f.png)[![giiant-0 2-screen-2](https://cloud.githubusercontent.com/assets/649031/5692429/c9189492-98f5-11e4-969f-02a302ca6974.png)](https://cloud.githubusercontent.com/assets/649031/5692429/c9189492-98f5-11e4-969f-02a302ca6974.png)

Links
-----

[](#links)

- [Phundament.com](http://phundament.com)
- [GitHub](https://github.com/schmunk42/yii2-giiant)
- [Packagist](https://packagist.org/packages/schmunk42/yii2-giiant)
- [Yii Extensions](http://www.yiiframework.com/extension/yii2-giiant/)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~49 days

Total

6

Last Release

3975d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed3ff02e52f172e8f9d8d2fd1942f9d30e98b479bcf43502bdc7889dbf1317cd?d=identicon)[zolotarev](/maintainers/zolotarev)

---

Top Contributors

[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (264 commits)")[![cornernote](https://avatars.githubusercontent.com/u/51875?v=4)](https://github.com/cornernote "cornernote (30 commits)")[![zolotarev](https://avatars.githubusercontent.com/u/2485810?v=4)](https://github.com/zolotarev "zolotarev (9 commits)")[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (8 commits)")[![marc7000](https://avatars.githubusercontent.com/u/1118837?v=4)](https://github.com/marc7000 "marc7000 (4 commits)")[![motin](https://avatars.githubusercontent.com/u/793037?v=4)](https://github.com/motin "motin (2 commits)")[![rowasc](https://avatars.githubusercontent.com/u/2434401?v=4)](https://github.com/rowasc "rowasc (2 commits)")[![kowa90](https://avatars.githubusercontent.com/u/328977?v=4)](https://github.com/kowa90 "kowa90 (1 commits)")[![einar-lanfranco](https://avatars.githubusercontent.com/u/3857748?v=4)](https://github.com/einar-lanfranco "einar-lanfranco (1 commits)")[![Konrad90](https://avatars.githubusercontent.com/u/328977?v=4)](https://github.com/Konrad90 "Konrad90 (1 commits)")[![stphivos](https://avatars.githubusercontent.com/u/10588742?v=4)](https://github.com/stphivos "stphivos (1 commits)")[![thiagotalma](https://avatars.githubusercontent.com/u/612578?v=4)](https://github.com/thiagotalma "thiagotalma (1 commits)")

---

Tags

yii2crudgii

### Embed Badge

![Health badge](/badges/zolotarev-yii2-giiant/health.svg)

```
[![Health](https://phpackages.com/badges/zolotarev-yii2-giiant/health.svg)](https://phpackages.com/packages/zolotarev-yii2-giiant)
```

###  Alternatives

[schmunk42/yii2-giiant

Gii CRUD generator for Yii 2 Framework

269471.5k17](/packages/schmunk42-yii2-giiant)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
