PHP Classes

How to Use a PHP Fixtures Generator Package to Yii2 Fixture ii: Generate fixture code files from templates scripts

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-04-22 (11 months ago) RSS 2.0 feedNot enough user ratingsTotal: 1 All time: 11,545 This week: 80Up
Version License PHP version Categories
yii2-fixturegii 1.0MIT/X Consortium ...5Databases, Libraries, Code Generation, C...
Description 

Author

This package can Generate fixture code files from templates scripts.

It provides several types of classes that extend the Yii2 framework generator class to generate files of different types.

Currently, it can generate fixture code files from database tables as:

- Classes

- Global code scripts

- Configuration code scripts using returned arrays

Picture of Insolita
  Performance   Level  
Innovation award
Innovation award
Nominee: 18x

 

Example

#!/usr/bin/env php
<?php
require(__DIR__ . '/bootstrap.php');
$config = require(__DIR__ . '/config/app.php');
$app = new yii\console\Application($config);
$exitCode = $app->run();
exit(
$exitCode);


Details

Yii2-fixture/template-generator

Status Latest Stable Version Total Downloads License

Gii fixture helper - generate fixture classes; faker templates; fixture data files from table support bulk template and data-file generations

Installation

composer require --dev --prefer-dist insolita/yii2-fixturegii "~3.0.0"

or add

"insolita/yii2-fixturegii": "~3.0.0"

to the require-dev section of your composer.json file.

Usage

Register insolita\fixturegii\Bootstrap in bootstrap section of backend application, or add needed generators in section of gii module

Go to gii and use new Generators

Suggest:

define '@test' or '@fixture' alias for quick path setup

Customize

Set up in gii config sections

  $config['modules']['gii'] = [
          'class' => 'yii\gii\Module',
          'generators' => [
              //...
              'fixtureClass'=>[
                  'class'=>\insolita\fixturegii\generators\ClassGenerator::class,
                  'templates'=>[
                           //add your custom
                  ]
              ],
              'fixtureData'=>[
                  'class'=>\insolita\fixturegii\generators\DataGenerator::class,
                  'tableResolverClass'=>'You can set own implementation',
                  'templates'=>[
                        //add your custom
                  ]
              ],
              'fixtureTemplate'=>[
              'class'=>\insolita\fixturegii\generators\TemplateGenerator::class,
                'tableResolverClass'=>'You can set own implementation',
                'columnResolverClass'=>'You can set own implementation',
                'templates'=>[
                        //add your custom
                ]
              ],
          ]
          //...
      ];


  Files folder image Files (36)  
File Role Description
Files folder imagesrc (1 file, 6 directories)
Files folder imagetests (3 files, 4 directories)
Accessible without login Plain text file .dockerignore Data Auxiliary data
Accessible without login Plain text file .php_cs.dist Example Example script
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file codeception.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file Makefile Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:1
This week:0
All time:11,545
This week:80Up