PHP code example of stemizer / php-migration

1. Go to this page and download the library: Download stemizer/php-migration 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/ */

    

stemizer / php-migration example snippets


/**
 * pdo instance
 */
$instance = new PDO(args);

/**
 * example migration scripts :
 * 0-create-tbl-foo.sql
 * 1-modify-tbl-foo.sql
 * 2-another-migration.sql
 * 2-foo-new-fields.sql
 * 3-foo-new-index.sql
 */
$scripts_dir = '/var/www/myproject/any/path';

/**
 * no output
 */
$migration = new YD\Migration($instance, $scripts_dir);
$migration->run();