janalis / doctrineviz
Generate Graphviz DOT diagrams from a Doctrine DBAL database schema.
Requires
- php: ^8.5
- doctrine/dbal: ^4.5
- doctrine/doctrine-bundle: ^3.3
- doctrine/persistence: ^4.0
- janalis/viz: ^0.2.2
- symfony/console: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/filesystem: ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
Requires (Dev)
- carthage-software/mago: ^1.57
- infection/infection: ^0.35.8
- phpunit/phpunit: ^12.5
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/process: ^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
doctrineviz
Your database schema, drawn.
Doctrine DBAL · Graphviz, Mermaid and PlantUML · SVG, PNG and PDF · Symfony bundle
Documentation · Installation · Command reference · Migration
doctrineviz reads your database schema through Doctrine DBAL and generates a Graphviz, Mermaid or PlantUML diagram with tables, columns, primary keys and foreign keys, or renders it straight to SVG, PNG or PDF with viz, natively in PHP. Run it in a Symfony application, or use the exporter directly with a DBAL schema. Doctrine ORM is optional.
Install
composer require --dev janalis/doctrineviz
Register Janalis\Doctrineviz\DoctrinevizBundle::class for the dev and
test environments in config/bundles.php. Requires PHP 8.5+, Symfony
7.4 or 8.x, DoctrineBundle 3.3+, and DBAL 4.5+.
See Installation.
Quick start
php bin/console doctrine:schema:graphviz --output=schema.svg # drawn natively, no Graphviz needed php bin/console doctrine:schema:graphviz --output=schema.pdf php bin/console doctrine:schema:graphviz --format=mermaid > schema.mmd php bin/console doctrine:schema:graphviz --format=plantuml > schema.puml php bin/console doctrine:schema:graphviz > schema.dot
Highlights
- Database schema diagrams show the actual schema, including tables not mapped by ORM.
- Three languages: Graphviz DOT, a Mermaid
erDiagramand a PlantUML entity diagram, with cardinalities. - Images without tools:
--output=schema.svg|png|pdfrenders natively;--engine=cliusesdot,mmdcorplantumlinstead. - Column details include DBAL type, length, nullability, defaults and auto-increment.
- Relationships preserve composite foreign-key column pairs and self-references.
- Named connections through
--connection=reporting. - Optional Gedmo links through
--infer-gedmo-translationsand--infer-gedmo-logs. - Reusable exporter accepts a DBAL
Schemawithout booting Symfony.
Contributing
Read CONTRIBUTING.md and the development guide. Use synthetic schemas in reports and tests; redact connection details and private data.
make install make verify # formatting, lint, analysis, workflows, tests, 100% coverage and MSI make docs # build the VitePress documentation make help # list all developer commands