PHP code example of io4n / yii2-dump

1. Go to this page and download the library: Download io4n/yii2-dump 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/ */

    

io4n / yii2-dump example snippets


return [
    'controllerMap' => [
        'dump' => [
            'class' => 'hzhihua\dump\DumpController',
            'filePrefix' => '123456_654321',
            'tableOptions' => 'ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci', // if mysql >= 5.7, you can set “ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci”,
        ],
    ],
];

return [
    'controllerMap' => [
        'dump' => [
            'class' => 'hzhihua\\dump\\DumpController',
            'db' => 'db', // Connection
            'templateFile' => '@vendor/hzhihua/yii2-dump/templates/migration.php',
            'generatePath' => '@console/migrations',
            'table' => 'table1,table2', // select which table will be dump(default filter migration table)
            'filter' => 'table3,table4', // table3 and table4 will be filtered when generating migration file
            'limit' => '0,1000', // select * from tableName limit 0,1000
            'filePrefix' => '123456_654321',
            'tableOptions' => 'ENGINE=InnoDB CHARACTER SET=utf8 COLLATE=utf8_unicode_ci', // if mysql >= 5.7, you can set “ENGINE=InnoDB CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci”,
            // ... ...
        ],
    ],
];

./yii help dump

./yii dump -limit=10

./yii dump -table=table1,table2

./yii dump -table=table1,table2 -data=table1

./yii dump -filter=table1,table2

./yii dump/create

./yii dump/create