Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: beyondcode/laravel-er-diagram-generator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.1.1
Choose a base ref
...
head repository: beyondcode/laravel-er-diagram-generator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 18, 2018

  1. Adds tests for traits and default filenames

    Jordan Hoff committed Jul 18, 2018
    Copy the full SHA
    ef6c2a5 View commit details
  2. Change assertion on jpeg test

    Jordan Hoff committed Jul 18, 2018
    Copy the full SHA
    ea3cb30 View commit details

Commits on Jul 23, 2018

  1. Adding graphviz to travis

    Jordan Hoff committed Jul 23, 2018
    Copy the full SHA
    d45775f View commit details

Commits on Jul 24, 2018

  1. Merge pull request #26 from jhoff/add_tests

    Adds tests for traits and default filenames
    mpociot authored Jul 24, 2018
    Copy the full SHA
    24c9091 View commit details

Commits on Jul 30, 2018

  1. Copy the full SHA
    c0f75b0 View commit details

Commits on Jul 31, 2018

  1. Merge pull request #31 from diogogomeswww/enhancement/minor-perfomanc…

    …e-improvements
    
    Minor performance improvements and some docblocks
    mpociot authored Jul 31, 2018
    Copy the full SHA
    981d387 View commit details

Commits on Aug 6, 2018

  1. Copy the full SHA
    6098253 View commit details

Commits on Aug 15, 2018

  1. Merge pull request #32 from diogogomeswww/enhancement/add-config-igno…

    …re-model-or-relation
    
    Add config option to ignore model or just a relation
    mpociot authored Aug 15, 2018
    Copy the full SHA
    ac98742 View commit details
  2. Update config.php

    mpociot authored Aug 15, 2018
    Copy the full SHA
    89f0c9b View commit details
  3. Update README.md

    mpociot authored Aug 15, 2018
    Copy the full SHA
    620914e View commit details

Commits on Sep 10, 2018

  1. add abstract class

    diogogomeswww committed Sep 10, 2018
    Copy the full SHA
    2c36b14 View commit details
  2. Copy the full SHA
    eb53562 View commit details

Commits on Sep 19, 2018

  1. Merge pull request #37 from diogogomeswww/feature/ignore-abstract-cla…

    …sses
    
    Feature - Ignore abstract classes
    mpociot authored Sep 19, 2018
    Copy the full SHA
    e9b835e View commit details

Commits on Dec 9, 2018

  1. Update README.md

    mpociot authored Dec 9, 2018
    Copy the full SHA
    43c3a3d View commit details

Commits on Apr 18, 2019

  1. Update composer.json

    Remove undefined facade/alias
    drbyte authored Apr 18, 2019
    Copy the full SHA
    6b74d6b View commit details

Commits on May 30, 2019

  1. getForeignKey => getForeignKeyName (#53)

    Fixing for laravel 5.8:
    #50 #52
    Yahav authored and jafar690 committed May 30, 2019
    Copy the full SHA
    70c8cf8 View commit details
  2. Fix model names with underscores (#41)

    * change Avatar to User_Avatar
    
    * fix tests
    
    * remove - from node name
    
    * docblocks
    
    * fix ref
    
    * snapshots
    
    * make unit test to ensure hiphens are handle
    
    * rename User_Avatar to Avatar, it's nicer
    
    * fix docblocks
    diogogomeswww authored and jafar690 committed May 30, 2019
    Copy the full SHA
    011694b View commit details

Commits on Sep 4, 2019

  1. Merge pull request #51 from drbyte/patch-1

    Update composer.json
    mpociot authored Sep 4, 2019
    Copy the full SHA
    83e7de8 View commit details
  2. add Laravel 6 support

    mpociot committed Sep 4, 2019
    Copy the full SHA
    0268113 View commit details

Commits on Oct 14, 2019

  1. Fix the broken tests for older laravel versions (#63)

    * Sort the models to get the same results for laravel 5.6 as for the newer versions
    
    * Make the relations backward compatible with < laravel 5.8
    daniel-werner authored and jafar690 committed Oct 14, 2019
    Copy the full SHA
    d027d5e View commit details
  2. This PR adds support for pivot tables for belongsToMany relationships. (

    #64)
    
    * Add support for including pivot table for belongsToMany relationships
    
    * Fix the relation key names for the lowest supported versions
    
    * Sort the models to get the same results for laravel 5.6 as for the newer versions
    
    * Make the relations backward compatible with < laravel 5.8
    
    * Catch the reflection exception
    
    * Scrunitizer suggested fixes
    daniel-werner authored and jafar690 committed Oct 14, 2019
    Copy the full SHA
    afbe30a View commit details
  3. Removed deprecated global helper array and str. Replaced with \Illumi…

    …nate\Support classes (#60)
    henryavila authored and jafar690 committed Oct 14, 2019
    Copy the full SHA
    b4819e5 View commit details

Commits on Oct 8, 2020

  1. Allow whilstlisting models

    iforwms committed Oct 8, 2020
    Copy the full SHA
    ba7abaa View commit details
  2. Merge pull request #87 from iforwms/feature/whitelist

    Allow white-listing models
    mpociot authored Oct 8, 2020
    Copy the full SHA
    2578ea9 View commit details

Commits on Dec 3, 2020

  1. Update base path

    eiko03 authored Dec 3, 2020
    Copy the full SHA
    d457222 View commit details

Commits on Feb 3, 2021

  1. Merge pull request #90 from eiko03/patch-1

    Update base path
    mpociot authored Feb 3, 2021
    Copy the full SHA
    de3b7d5 View commit details

Commits on Jul 21, 2021

  1. Copy the full SHA
    0370e82 View commit details

Commits on Feb 5, 2022

  1. Copy the full SHA
    147da1d View commit details

Commits on Feb 10, 2023

  1. Copy the full SHA
    0d569d4 View commit details
  2. Merge pull request #102 from laravel-shift/l9-compatibility

    - Laravel 9 compatibility
    - Laravel 10 compatibility
    - Use `DIRECTORY_SEPARATOR` in config
    mechelon authored Feb 10, 2023
    Copy the full SHA
    548a1f3 View commit details

Commits on Apr 25, 2023

  1. Copy the full SHA
    e3c3211 View commit details

Commits on Feb 14, 2024

  1. allow php-parser 5.x

    NiclasvanEyk authored Feb 14, 2024
    Copy the full SHA
    0d570d3 View commit details
  2. Copy the full SHA
    f00dbbd View commit details

Commits on Mar 15, 2024

  1. Fixed test

    mechelon committed Mar 15, 2024
    Copy the full SHA
    a961d32 View commit details
  2. Copy the full SHA
    9ccc93b View commit details
  3. Merge pull request #106 from orkhanahmadov/patch-1

    FIx PHP 8.2 deprecations with string interpolation
    mechelon authored Mar 15, 2024
    Copy the full SHA
    d31e67a View commit details
  4. Merge pull request #99 from SONGHQ/fix/avoid-destructive-static-methods

    Reject static methods when searching for model relationships
    mechelon authored Mar 15, 2024
    Copy the full SHA
    facb5e6 View commit details
  5. Merge pull request #108 from NiclasvanEyk/allow-phpparser-5

    Allow php-parser 5.x
    mechelon authored Mar 15, 2024
    Copy the full SHA
    7796af7 View commit details
  6. Updated dependencies

    mechelon committed Mar 15, 2024
    Copy the full SHA
    fe3238d View commit details
  7. Merge pull request #111 from beyondcode/updates

    2.1.0
    mechelon authored Mar 15, 2024
    Copy the full SHA
    60799f3 View commit details

Commits on Oct 6, 2024

  1. Copy the full SHA
    77c227e View commit details

Commits on Dec 6, 2024

  1. Merge pull request #116 from marzvrover/master

    Enable support for laravel 11.x and php 8.x
    mechelon authored Dec 6, 2024
    Copy the full SHA
    be74cdd View commit details
  2. Merge pull request #117 from beyondcode/laravel-11

    Laravel 11 & PHP 8.4 Support
    mechelon authored Dec 6, 2024
    Copy the full SHA
    8df44b2 View commit details
  3. Refactor phpunit.xml.dist

    mechelon committed Dec 6, 2024
    Copy the full SHA
    07254be View commit details
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -3,4 +3,6 @@ composer.lock
docs
vendor
coverage
.idea
.idea
tests/__snapshots__/
.phpunit.result.cache
19 changes: 0 additions & 19 deletions .scrutinizer.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Laravel ER Diagram Generator

[![Latest Version on Packagist](https://img.shields.io/packagist/v/beyondcode/laravel-er-diagram-generator.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-er-diagram-generator)
[![Build Status](https://img.shields.io/travis/beyondcode/laravel-er-diagram-generator/master.svg?style=flat-square)](https://travis-ci.org/beyondcode/laravel-er-diagram-generator)
[![Quality Score](https://img.shields.io/scrutinizer/g/beyondcode/laravel-er-diagram-generator.svg?style=flat-square)](https://scrutinizer-ci.com/g/beyondcode/laravel-er-diagram-generator)
[![Total Downloads](https://img.shields.io/packagist/dt/beyondcode/laravel-er-diagram-generator.svg?style=flat-square)](https://packagist.org/packages/beyondcode/laravel-er-diagram-generator)

This package lets you generate entity relation diagrams by inspecting the relationships defined in your model files.
It is highly customizable.
Behind the scenes, it uses [GraphViz](https://www.graphviz.org) to generate the graph.

> If you want to learn how to create reusable PHP packages yourself, take a look at my upcoming [PHP Package Development](https://phppackagedevelopment.com) video course.
## Prerequisites

The minimum required PHP version is 7.1.0.
@@ -29,6 +29,8 @@ Or, if you are using Homestead:
sudo apt-get install graphviz
```

To install Graphviz on Windows, download it from the [official website](https://graphviz.gitlab.io/_pages/Download/Download_windows.html).

## Installation

You can install the package via composer:
@@ -42,13 +44,13 @@ If you are using Laravel 5.5+, the package will automatically register the servi
If you are using Lumen, you will need to add the following to `bootstrap\app.php`:

```php
\\ Register Service Providers
# Register Service Providers
$app->register(BeyondCode\ErdGenerator\ErdGeneratorServiceProvider::class);
```

## Usage

By default, the package will automatically detect all models in your `app` directory that extend the Eloquent Model class. If you would like you explicitly define where your models are located, you can publish the configuration file using the following command.
By default, the package will automatically detect all models in your `app/Models` directory that extend the Eloquent Model class. If you would like you explicitly define where your models are located, you can publish the configuration file using the following command.

```bash
php artisan vendor:publish --provider=BeyondCode\\ErdGenerator\\ErdGeneratorServiceProvider
18 changes: 7 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
@@ -16,16 +16,16 @@
}
],
"require": {
"php": "^7.1",
"doctrine/dbal": "~2.3",
"php": "^7.1|^8.0",
"doctrine/dbal": "~2.3|^3.3|^4.0",
"phpdocumentor/graphviz": "^1.0",
"nikic/php-parser":"^2.0|^3.0|^4.0"
"nikic/php-parser": "^2.0|^3.0|^4.0|^5.0"
},
"require-dev": {
"larapack/dd": "^1.0",
"orchestra/testbench": "~3.5",
"phpunit/phpunit": "^7.0",
"spatie/phpunit-snapshot-assertions": "^1.3"
"orchestra/testbench": "~3.5|~3.6|~3.7|~3.8|^4.0|^7.0|^8.0|^9.0",
"phpunit/phpunit": "^7.0| ^8.0|^9.5.10|^10.5|^11.0.1",
"spatie/phpunit-snapshot-assertions": "^1.3|^4.2|^5.1"
},
"autoload": {
"psr-4": {
@@ -40,7 +40,6 @@
"scripts": {
"test": "vendor/bin/phpunit",
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"

},
"config": {
"sort-packages": true
@@ -49,10 +48,7 @@
"laravel": {
"providers": [
"BeyondCode\\ErdGenerator\\ErdGeneratorServiceProvider"
],
"aliases": {
"ErdGenerator": "BeyondCode\\ErdGenerator\\ErdGeneratorFacade"
}
]
}
}
}
27 changes: 26 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
@@ -7,7 +7,32 @@
* By default, the `app` directory will be scanned recursively for models.
*/
'directories' => [
base_path('app'),
base_path('app' . DIRECTORY_SEPARATOR . 'Models'),
],

/*
* If you want to ignore complete models or certain relations of a specific model,
* you can specify them here.
* To ignore a model completely, just add the fully qualified classname.
* To ignore only a certain relation of a model, enter the classname as the key
* and an array of relation names to ignore.
*/
'ignore' => [
// User::class,
// Post::class => [
// 'user'
// ]
],

/*
* If you want to see only specific models, specify them here using fully qualified
* classnames.
*
* Note: that if this array is filled, the 'ignore' array will not be used.
*/
'whitelist' => [
// App\User::class,
// App\Post::class,
],

/*
17 changes: 0 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="BeyondCode Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>
12 changes: 12 additions & 0 deletions src/Edge.php
Original file line number Diff line number Diff line change
@@ -4,12 +4,24 @@

use phpDocumentor\GraphViz\Node;

/**
* Class Edge
* @package BeyondCode\ErdGenerator
* @method void setLabel(string $name)
* @method void setXLabel(string $name)
*
*/
class Edge extends \phpDocumentor\GraphViz\Edge
{
protected $fromPort = null;

protected $toPort = null;

/**
* @param Node $from
* @param Node $to
* @return Edge|\phpDocumentor\GraphViz\Edge
*/
public static function create(Node $from, Node $to) {
return new static($from, $to);
}
9 changes: 6 additions & 3 deletions src/GenerateDiagramCommand.php
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@

namespace BeyondCode\ErdGenerator;

use ReflectionClass;
use BeyondCode\ErdGenerator\Model as GraphModel;
use Illuminate\Console\Command;
use phpDocumentor\GraphViz\Graph;
use Illuminate\Support\Collection;
use BeyondCode\ErdGenerator\Model as GraphModel;
use phpDocumentor\GraphViz\Graph;
use ReflectionClass;

class GenerateDiagramCommand extends Command
{
@@ -49,6 +49,9 @@ public function __construct(ModelFinder $modelFinder, RelationFinder $relationFi
$this->graphBuilder = $graphBuilder;
}

/**
* @throws \phpDocumentor\GraphViz\Exception
*/
public function handle()
{
$models = $this->getModelsThatShouldBeInspected();
Loading