PHP Classes

How to Use a PHP CRUD Template Generator to Create Twig Template Files to Manipulate Yii2 Model Class Objects Using the Package Yii2 Giitwig: Implement CRUD applications using Twig templates

Recommend this page to a friend!
  Info   View files Example   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-29 (2 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
yii2-giitwig 1.0MIT/X Consortium ...5PHP 5, Libraries, Code Generation, De...
Description 

Author

This package can be used to implement CRUD applications using Twig templates.

It provides a generator class to generate templates in Twig format for CRUD applications implemented with the Yii2 framework model classes.

The configuration of the templates to generate needs to be added to the composer.json file of your project.

Picture of Insolita
  Performance   Level  
Name: Insolita <contact>
Classes: 24 packages by
Country: Russian Federation Russian Federation
Innovation award
Innovation award
Nominee: 17x

Example

<?php
/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */
/* @var $generator insolita\giitwig\crud\Generator */

echo $form->field($generator, 'modelClass');
echo
$form->field($generator, 'searchModelClass');
echo
$form->field($generator, 'controllerClass');
echo
$form->field($generator, 'viewPath');
echo
$form->field($generator, 'baseControllerClass');
echo
$form->field($generator, 'indexWidgetType')->dropDownList([
   
'grid' => 'GridView',
   
'list' => 'ListView',
]);
//echo $form->field($generator, 'enableI18N')->checkbox();
echo $form->field($generator, 'messageCategory');


Details

Gii Twig -Crud

Gii Twig Template Generator (Port default yii2-gii templates) (Without i18N support yet)

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist insolita/yii2-giitwig "*"

or add

"insolita/yii2-giitwig": "*"

to the require section of your composer.json file.

Usage

Twig settings

'view'=>[
            'class'=>'yii\web\View',
            'renderers'=>[
                'twig' => [
                    'class' => 'yii\twig\ViewRenderer',
                    'cachePath' => '@runtime/Twig/cache',
                    'options' => [
                        'auto_reload' => true,
                    ],
                    'globals' => ['html' => '\yii\helpers\Html','arhelp'=>'\yii\helpers\ArrayHelper','url'=>'yii\helpers\Url'],
                    'uses' => ['yii\bootstrap'],],
            ]

]

Gii settings

$config['modules']['gii'] = [
        'class'=>'yii\gii\Module',
        'generators' => [
            'twigcrud' => [
                'class' => 'insolita\giitwig\crud\Generator', // generator class
                'templates' => [
                    'twigCrud' => '@insolita/giitwig/crud/default',
                ]
            ]
        ],
    ];

for customize - copy files from @insolita/giitwig/crud/default to any place, customize and add

$config['modules']['gii'] = [
        'class'=>'yii\gii\Module',
        'generators' => [
            'twigcrud' => [
                'class' => 'insolita\giitwig\crud\Generator', // generator class
                'templates' => [
                    'twigCrud' => '@insolita/giitwig/crud/default',
                    'twigcustomCrud' => '@your/path/to/crud/customized',
                ]
            ]
        ],
    ];

  Files folder image Files  
File Role Description
Files folder imagecrud (2 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  crud  
File Role Description
Files folder imagedefault (2 files, 1 directory)
  Accessible without login Plain text file form.php Example Example script
  Plain text file Generator.php Class Class source

  Files folder image Files  /  crud  /  default  
File Role Description
Files folder imageviews (7 files)
  Accessible without login Plain text file controller.php Example Example script
  Accessible without login Plain text file search.php Example Example script

  Files folder image Files  /  crud  /  default  /  views  
File Role Description
  Accessible without login Plain text file create.php Example Example script
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file update.php Example Example script
  Accessible without login Plain text file view.php Example Example script
  Accessible without login Plain text file _form.php Example Example script
  Accessible without login Plain text file _listviewitems.php Example Example script
  Accessible without login Plain text file _search.php Example Example script

 Version Control Unique User Downloads  
 100%
Total:0
This week:0