1. Go to this page and download the library: Download rotexsoft/sqlschema 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/ */
rotexsoft / sqlschema example snippets
use Rotexsoft\SqlSchema\ColumnFactory;
use Rotexsoft\SqlSchema\MysqlSchema; // for MySQL
use Rotexsoft\SqlSchema\PgsqlSchema; // for PostgreSQL
use Rotexsoft\SqlSchema\SqliteSchema; // for Sqlite
use Rotexsoft\SqlSchema\SqlsrvSchema; // for Microsoft SQL Server
use PDO;
// a PDO connection
$pdo = new PDO(...);
// a column definition factory
$column_factory = new ColumnFactory();
// the schema discovery object
$schema = new MysqlSchema($pdo, $column_factory);
$cols = $schema->fetchTableCols('table_name');
foreach ($cols as $name => $col) {
echo "Column $name is of type "
. $col->type
. " with a size of "
. $col->size
. PHP_EOL;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.