PHP code example of phlib / schemadiff
1. Go to this page and download the library: Download phlib/schemadiff 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 / schemadiff example snippets
bash
$ composer global
php
$pdo = new \PDO('mysql:...', $username, $password);
$schemaInfo1 = \Phlib\SchemaDiff\SchemaInfoFactory::fromPdo($pdo, 'db1');
$schemaInfo2 = \Phlib\SchemaDiff\SchemaInfoFactory::fromPdo($pdo, 'db2');
$schemaDiff = new \Phlib\SchemaDiff\SchemaDiff(
new Symfony\Component\Console\Output\StreamOutput(STDOUT)
);
$different = $schemaDiff->diff($schemaInfo1, $schemaInfo2);
exit($different ? 1 : 0);