Yii2 custom gii generator and template?

yii2 gii
gii code template
yii2 gii model
yii2 gui
yii2 frame
yii2 create search model
yii2 class
yii2 tutorial

I just implementing a new gii generator for my requirement on yii2. i want to know best place to keep those codes?

Create app\modules\gii directory with own Generator class, views, templates.

namespace app\modules\gii;

class MyCustomGenerator extends \yii\gii\generators\crud\Generator
{
    // ...

    public function generate()
    {
        // ...
    }
}

Then enable it in gii configuration.

[
    // ...
    'modules' => [
        'gii' => [
            'class'      => 'yii\gii\Module',
            'generators' => [
                'class' => '\app\modules\gii\MyCustomGenerator',
                'model' => ['class' => '\app\modules\gii\model\MyCustomGenerator'],
            ],
        ],
    ],
]

Additional topics: Creating your own generators, In order to create your own generator, you need to create or override these classes in any folder. Again as in the previous section customize the configuration: Yii2-gii. It add theming generator and new template for crud.It based on yiisoft/yii2-gii. Installation. The preferred way to install this extension is through composer. Either run. php composer.phar require-dev myzero1/yii2-gii:1.* or add "myzero1/yii2-gii": "~1.0.0" to the require-dev section of your composer.json file. Setting

Which module of gii that you need to custom? If it is CRUD module, I think you should put it into app/backend/ because it just use for this app.

Here is my customization: custom crud gii templates

My folder structure: yii2 - custom gii crud templates - folder structure

Yii2 custom gii generator and template?, Create app\modules\gii directory with own Generator class, views, templates. namespace app\modules\gii; class MyCustomGenerator extends  Yii 2 (in Chinese means “simple and evolutionary”) is a modern framework designed to be a solid foundation for your PHP application. Yii2 is a great choice if you want to save time on your development process. It has a CRUD generating module called Gii built into it. It helps you generate a lot of common code quickly.

Yii2 - Gii generators - how to custom crud templates, 6/27/17. Yii2 - Gii generators - how to custom crud templates. 1. Create your template folders in  The Gii CRUD Generator. So far we’ve been doing the code generating in a somewhat piecemeal way. With Gii, we can do an entire php CRUD scenario for tables in our database. In this go around, we’ll create a drums table and let Gii create the entire setup for us. 1. Create The Drums Table

Generator, yii\gii\Generator, Source Code, https://github.com/yiisoft/yii2-gii/blob/master/Generator.php string​, The root path of the template files that are currently being used. yii\gii\Generator 'password'], 'required'], // built-in "string" validator customized with "min" and  Other example, an advanced example list of commands could also be seen here which are the related commands for generating working REST resources in the app template I linked before. Built With. yiisoft/yii2 - this extension is powered by and for Yii framework 2.0 based applications. yiisoft/yii2-gii - the official Gii Extension for Yii

How to create custom crud generator templates in Yii2-gii?, A step by Step guide to create custom crud generator templates in Yii2-gii .Rudra Softech is a Software development company for open source  AdminLTE Asset Bundle. Backend UI for Yii2 Framework, based on AdminLTE. This package contains an Asset Bundle for Yii 2.0 Framework which registers the CSS files for the AdminLTE user-interface.

Yii Framework: Tailoring Code Generators For Your App, Yii 1.1.2 introduced a module named Gii (rhymes with “Yee”) that took code generation to the web and made it fully customizable. Now you could have templates  แม่แบบ(Application Template) ใน Yii2. Gii การใช้ Gii Generator สำหรับ Basic Template. การสร้าง Virtual Host สำหรับ Yii2 Basic Application Template. การติดตั้ง Yii2 Advanced Application Template. Gii Generator สำหรับ Advanced Template

Comments
  • See official guide - Creating your own templates.
  • i know how to write, what i want is were to place the generator and template.
  • @VijayArun Place them in app\modules\gii, as I told in my anwer.