1. Go to this page and download the library: Download peptolab/phpdb-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/ */
peptolab / phpdb-migration example snippets
use PhpDb\Adapter\Adapter;
use PhpDb\Migration\MigrationRunner;
use PhpDb\Migration\MismatchStrategy;
$adapter = new Adapter([
'driver' => 'Pdo_Mysql',
'database' => 'mydb',
'username' => 'root',
'password' => '',
]);
$runner = new MigrationRunner(
adapter: $adapter,
migrationsPath: __DIR__ . '/data/migrations',
migrationsNamespace: 'MyApp\\Migrations',
mismatchStrategy: MismatchStrategy::Report,
);
$runner->ensureMigrationsTable();
$results = $runner->runPending();