Skip to content
Laraver wrapper package for SchemaCrawler. Generate ER diagram for your Laravel application right from the database.
PHP Other
  1. PHP 99.1%
  2. Other 0.9%
Branch: master
Clone or download
Latest commit 9ae307a Oct 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin/schemacrawler
config
database/migrations
src
tests
.gitignore
.rmt.yml
.scrutinizer.yml
.styleci.yml
.travis.yml
CHANGELOG
CONTRIBUTING.md
LICENSE
LICENSE.md
README.md
RMT
composer.json
composer.lock
phpcs.xml
phpmd.xml
phpunit.xml.dist

README.md

Laravel SchemaCrawler

Latest Version on Packagist Build Status Quality Score Total Downloads

This package is a wrapper for the SchemaCrawler. It allows you to generate ER diagram right from the database. It is capable of creating database diagram from the default schema with zero configuration, but it also offers configuration options for more advanced usage.

Requirements

This package ships with the built in SchemaCrawler, and it requires installed java version 8 and Graphviz.

MacOS users can install Graphviz via HomeBrew:

brew install graphviz

Homestead or Ubuntu users can install it via package manager:

sudo apt-get install graphviz

Installation

You can install the package via composer:

composer require daniel-werner/laravel-schemacrawler --dev

Usage

You can generate the diagram using the console command or accessing the /schema url.

Console command

php artisan schema:generate

Running this command will generate a pdf version of the default configured database, the schema.pdf will be placed in the storage/app/ directory.

The possible configuration options are the following:

--output-file[=OUTPUT-FILE]       [default: "schema.pdf"] The name of the generated file
--output-format[=OUTPUT-FORMAT]   [default: "pdf"] The output file type, possible values: pdf, png, svg, html
--connection[=CONNECTION]         [default: "default"] The connection name to use for diagram generation
--info-level[=INFO-LEVEL]         [default: "standard"] Info level for SchemaCrawler, possible values are :detailed, maximum, minimum, standard, unknown
--command[=COMMAND]               [default: "schema"] Command for the SchemaCrawler

The following commands are available:

brief Shows basic schema information, for tables, views and routines, columns, primary keys, and foreign keys

count Shows counts of rows in the tables

details Shows maximum possible detail of the schema, including privileges, and details of privileges, triggers, and check constraints

dump Shows data from all rows in the tables

lint Find lints (non-adherence to coding standards and conventions) in the database schema

list Shows a list of schema objects

quickdump Shows data from all rows in the tables, but row order is not guaranteed - this can be used with a minimum info-level for speed

schema Shows the commonly needed detail of the schema, including details of tables, views and routines, columns, primary keys, indexes, foreign keys, and triggers

Url usage

By default the package registers the /schema route in your application. Visiting this url the package will generate a pdf version of the default database.

The default configuration can be overwritten with the following query parameters (e.g. /schema?output_file="database.pdf"):

output_file The name of the generated file

output_format The output file type, possible values: pdf, png, svg, html

connection The connection name to use for diagram generation

info_level Info level for SchemaCrawler, possible values are: detailed, maximum, minimum, standard, unknown

command - See the available commands above

Configuration

The default values for the above detailed configuration options are set up in the package's config file. If you'd like to change these default values, publish the config file with the following command:

php artisan vendor:publish --provider="DanielWerner\LaravelSchemaCrawler\LaravelSchemaCrawlerServiceProvider"

The above command will publish the laravel-schemacrawler.php file to your application's config directory.

Example output

This is the database schema of my pet projects Tracy.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email vernerd@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

You can’t perform that action at this time.