PHP code example of mhd-jalilvand / php-dbml-parser
1. Go to this page and download the library: Download mhd-jalilvand/php-dbml-parser 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/ */
mhd-jalilvand / php-dbml-parser example snippets
bmlParser\Parser;
$parser = new Parser('tests/test.dbml');
foreach($parser->tables as $table){
echo $table->name.':'.PHP_EOL;
foreach($table->columns as $column){
echo "\t".json_encode($column).PHP_EOL;
}
}
echo 'Relations:'.PHP_EOL;
foreach($parser->relations as $relation){
echo $relation->table->name.'.'.$relation->column->name;
echo ' '.$relation->type.' ';
echo $relation->foreign_table->name.'.'.$relation->foreign_column->name.PHP_EOL;
}
composer or/mhd-jalilvand/php-dbml-parser/example.php example.php
cp vendor/mhd-jalilvand/php-dbml-parser/tests -r tests
php example.php
phpunit tests/ParserTest.php