1. Go to this page and download the library: Download phlib/schema-change 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/ */
phlib / schema-change example snippets
$db = new Phlib\Db\Adapter([
'host' => '127.0.0.1',
'port' => '3306',
'username' => 'root',
'password' => '',
'dbname' => 'base_schema',
]);
$schemaChange = new \Phlib\SchemaChange\SchemaChange(
$db,
new \Phlib\SchemaChange\OnlineChangeRunner('/usr/local/bin/pt-online-schema-change')
);
$schemaChange->mapNames(new class implements \Phlib\SchemaChange\NameMapper {
public function mapTableName(string $table): string
{
return 'prefix_' . $table;
}
});