PHP code example of tunecino / yii2-schema-builder

1. Go to this page and download the library: Download tunecino/yii2-schema-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tunecino / yii2-schema-builder example snippets


/* preferably to add under 'dev' environment */

if (YII_ENV_DEV) {
   
    $config['bootstrap'][] = 'builder';
    $config['modules']['builder'] = [
        'class' => 'tunecino\builder\Module',
        /**
	  * Optional Attributes
	  *
	  * 'allowedIPs' => ...
	  * 'yiiScript' => ...
	  * 'dataPath' => ...
	  * 'previewUrlCallback' => ...
	  * 'commands' => ...
	  */
    ]; 
}

$commands = [
    // a string example representing the command to be executed
    'yii migrate/up --interactive=0',

    // a callable example returning a command or a list of commands to be executed
    function($schema) {
	// implement your logic here then
	// return either a string or an array of strings
    }

    // a custom generator (where you can also set default form values)
    [
        'class' => 'tunecino\builder\generators\model\Generator',
        'defaultAttributes' => [
            'ns' => 'api\modules\v1\models',
            'queryNs' => 'api\modules\v1\models',
        ],
    ],
];

$commands = [
    ['class' => 'tunecino\builder\generators\migration\Generator'],
    ['class' => 'tunecino\builder\generators\module\Generator'],
    ['class' => 'tunecino\builder\generators\model\Generator'],
    ['class' => 'tunecino\builder\generators\crud\Generator']
];

php composer.phar