{"id":15285389,"url":"https://github.com/pongee/database-schema-visualization","last_synced_at":"2025-10-08T16:06:34.549Z","repository":{"id":43360050,"uuid":"444937596","full_name":"pongee/database-schema-visualization","owner":"pongee","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-05T18:04:28.000Z","size":7480,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T06:38:43.917Z","etag":null,"topics":["database","mariadb","mysql","plantuml","visualization"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pongee.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-05T20:13:50.000Z","updated_at":"2025-01-05T18:03:50.000Z","dependencies_parsed_at":"2025-04-12T23:54:47.653Z","dependency_job_id":"fa382333-02ae-4116-8e5e-3a28e62a09d7","html_url":"https://github.com/pongee/database-schema-visualization","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/pongee/database-schema-visualization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pongee%2Fdatabase-schema-visualization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pongee%2Fdatabase-schema-visualization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pongee%2Fdatabase-schema-visualization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pongee%2Fdatabase-schema-visualization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pongee","download_url":"https://codeload.github.com/pongee/database-schema-visualization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pongee%2Fdatabase-schema-visualization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278972443,"owners_count":26078039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","mariadb","mysql","plantuml","visualization"],"created_at":"2024-09-30T15:04:31.116Z","updated_at":"2025-10-08T16:06:34.533Z","avatar_url":"https://github.com/pongee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Database schema visualization\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/pongee/database-schema-visualization.svg)](https://packagist.org/packages/pongee/database-schema-visualization)\n[![Minimum PHP Version](https://img.shields.io/packagist/php-v/pongee/database-schema-visualization)](https://php.net/)\n[![License](https://img.shields.io/github/license/pongee/database-schema-visualization)](https://github.com/pongee/database-schema-visualization/blob/main/LICENSE)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/pongee/database-schema-visualization)\n\n## Project goal\nThe aim of this project is to generate database documentation from sql schema.\n\n## Supported databases\n- MySQL\n- MariaDB\n- Apache Cassandra (Basics) \n\n## Supported Output formats\n- PNG, SVG image\n- Plantuml raw text\n- Json\n\n## Pre Installation\n- https://graphviz.gitlab.io/download/\n\n## Installation\n\n```bash\n$ composer require pongee/database-schema-visualization\nor add it the your composer.json and make a composer update pongee/database-schema-visualization.\n```\n## Usage\n### In console\n#### PNG export\n```bash\n$  php ./database-schema-visualization mysql:image ./example/schema/sakila.sql \u003e ./example/img/sakila.png\n$  php ./database-schema-visualization mysql:image --type png ./example/schema/sakila.sql \u003e ./example/img/sakila.png\n```\nOutput:\n![Example output](example/img/sakila.png?raw=true \"Output\")\n\n#### SVG export\n```bash\n$  php ./database-schema-visualization mysql:image --type svg ./example/schema/sakila.sql \u003e ./example/img/sakila.svg\n```\n\n#### Json export\n```bash\n$  php ./database-schema-visualization mysql:json ./example/schema/sakila.sql\n```\n#### Plantuml export\n```bash\n$  php ./database-schema-visualization mysql:plantuml ./example/schema/sakila.sql\n```\n\n### PHP\n#### Png export\n\n```php\n\u003c?php declare(strict_types=1);\n\nuse Pongee\\DatabaseSchemaVisualization\\DataObject\\Sql\\Database\\Connection\\ConnectionCollection;\nuse Pongee\\DatabaseSchemaVisualization\\Export\\Plantuml;\nuse Pongee\\DatabaseSchemaVisualization\\Generator\\ImageGenerator;\nuse Pongee\\DatabaseSchemaVisualization\\Parser\\MysqlParser;\n\ninclude __DIR__ . '/../../vendor/autoload.php';\n\n$sqlSchema = '\n  CREATE TABLE IF NOT EXISTS `foo` (\n    `id` INT(10) UNSIGNED NOT NULL COMMENT \"The id\"\n   ) ENGINE=innodb DEFAULT CHARSET=utf8;\n';\n\n$sqlParser                = new MysqlParser();\n// $cqlParser                = new \\Pongee\\DatabaseSchemaVisualization\\Parser\\CassandraParser();\n$plantumlExport             = new Plantuml(file_get_contents(__DIR__ . '/../../src/Template/Plantuml/v1.twig'));\n$forcedConnectionCollection = new ConnectionCollection();\n$imageGenerator             = new ImageGenerator(\n    'png',\n    __DIR__ . '/../../bin/plantuml.jar',\n    __DIR__ . '/../../tmp/'\n);\n\n$schema = $sqlParser-\u003erun($sqlSchema, $forcedConnectionCollection);\n\nprint $imageGenerator-\u003egenerate($plantumlExport-\u003eexport($schema));\n```\n#### Json export\n```php\n\u003c?php declare(strict_types=1);\n\nuse Pongee\\DatabaseSchemaVisualization\\DataObject\\Sql\\Database\\Connection\\ConnectionCollection;\nuse Pongee\\DatabaseSchemaVisualization\\Export\\Json;\nuse Pongee\\DatabaseSchemaVisualization\\Parser\\MysqlParser;\n\ninclude './vendor/autoload.php';\n\n$sqlSchema = '\n  CREATE TABLE IF NOT EXISTS `foo` (\n    `id` INT(10) UNSIGNED NOT NULL COMMENT \"The id\"\n   ) ENGINE=innodb DEFAULT CHARSET=utf8;\n';\n\n$mysqlParser                = new MysqlParser();\n$jsonExport                 = new Json();\n$forcedConnectionCollection = new ConnectionCollection();\n\n$schema = $mysqlParser-\u003erun($sqlSchema, $forcedConnectionCollection);\n\nprint $jsonExport-\u003eexport($schema);\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eThis will generate:\u003c/summary\u003e\n  \u003cdiv\u003e\n    \u003cpre\u003e\n{\n    \"tables\": {\n        \"foo\": {\n            \"columns\": [\n                {\n                    \"name\": \"id\",\n                    \"type\": \"INT\",\n                    \"typeParameters\": [\n                        \"10\"\n                    ],\n                    \"otherParameters\": \"UNSIGNED NOT NULL\",\n                    \"comment\": \"The id\"\n                }\n            ],\n            \"indexs\": {\n                \"simple\": [],\n                \"spatial\": [],\n                \"fulltext\": [],\n                \"unique\": []\n            },\n            \"primaryKey\": []\n        }\n    },\n    \"connections\": []\n}\n    \u003c/pre\u003e\n   \u003c/div\u003e\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpongee%2Fdatabase-schema-visualization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpongee%2Fdatabase-schema-visualization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpongee%2Fdatabase-schema-visualization/lists"}