PHP code example of mpeter-php / phpmig-mysqli-adapter

1. Go to this page and download the library: Download mpeter-php/phpmig-mysqli-adapter 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/ */

    

mpeter-php / phpmig-mysqli-adapter example snippets




hpmig\Adapter\MysqlIAdapter;
use Phpmig\Api\PhpmigApplication;
use Symfony\Component\Console\Output\NullOutput;

$mysqli = new mysqli('db_host', 'db_user', 'db_pass', 'my_database');

(new PhpmigApplication(
    new ArrayObject(
        [
            'phpmig.migrations_path' => __DIR__ . DIRECTORY_SEPARATOR . 'migrations',
            'phpmig.adapter'         => new MysqlIAdapter($mysqli, 'migrations'),
            'db'                     => $mysqli
        ]
    ), new NullOutput()
))->up();



/**
 * phpmig.php
 */

use Phpmig\Adapter;

$mysqli = new mysqli('db_host', 'db_user', 'db_pass', 'my_database');
return new ArrayObject(
    [
        [
            'phpmig.migrations_path' => __DIR__ . DIRECTORY_SEPARATOR . 'migrations',
            'phpmig.adapter'         => new Adapter\MysqlIAdapter($mysqli, 'migrations'),
            'db'                     => $mysqli
        ]
    ]
);


$ php composer.phar