PHPackages                             onurb/doctrine-metadata-grapher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. onurb/doctrine-metadata-grapher

ActiveLibrary[Database &amp; ORM](/categories/database)

onurb/doctrine-metadata-grapher
===============================

Helper to format doctrine metadata for UML API

1.1.11(8y ago)8108.3k↓40%32PHPPHP &gt;=5.3.2

Since Jul 3Pushed 5y ago2 watchersCompare

[ Source](https://github.com/Nono1971/Doctrine-MetadataGrapher)[ Packagist](https://packagist.org/packages/onurb/doctrine-metadata-grapher)[ Docs](http://www.doctrine-project.org/)[ RSS](/packages/onurb-doctrine-metadata-grapher/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (15)Used By (2)

Metagatagrapher for Yuml data preparation v 1.1
===============================================

[](#metagatagrapher-for-yuml-data-preparation-v-11)

[![Build Status](https://camo.githubusercontent.com/b8be1788b2293043bb167ef62c8bd2279ed314f19a109a83dd23b331fed3d70c/68747470733a2f2f7472617669732d63692e6f72672f4e6f6e6f313937312f446f637472696e652d4d65746164617461477261706865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Nono1971/Doctrine-MetadataGrapher) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/254a2d7ca96238596354027f6d65b0d4c124c61e30c47489b1253479f9fdfa6b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e6f6e6f313937312f446f637472696e652d4d65746164617461477261706865722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Nono1971/Doctrine-MetadataGrapher/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/a2694a4b0937862536f8742925b746ec761bf510c301164cc779d58e53fd9b8b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e6f6e6f313937312f446f637472696e652d4d65746164617461477261706865722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Nono1971/Doctrine-MetadataGrapher/?branch=master) [![Build Status](https://camo.githubusercontent.com/c7c5984e4b4dee5805d271d4d61e508b14dab877188377160cb62efcab16c0ef/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4e6f6e6f313937312f446f637472696e652d4d65746164617461477261706865722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Nono1971/Doctrine-MetadataGrapher/build-status/master) [![Latest Stable Version](https://camo.githubusercontent.com/fd96d68e9ef1258ccf102c6e73c85f5ef7a1930d7e4d306cbf43c963a4c68ece/68747470733a2f2f706f7365722e707567782e6f72672f6f6e7572622f646f637472696e652d6d657461646174612d677261706865722f762f737461626c65)](https://packagist.org/packages/onurb/doctrine-metadata-grapher) [![Total Downloads](https://camo.githubusercontent.com/ced09e7b5b13093bb7038b4589d53ea4f4e4abd7b7502d68a96141243a8722b4/68747470733a2f2f706f7365722e707567782e6f72672f6f6e7572622f646f637472696e652d6d657461646174612d677261706865722f646f776e6c6f616473)](https://packagist.org/packages/onurb/doctrine-metadata-grapher)

MetadataGrapher formats objects data to prepare data for [YUML](http://yuml.me) api to generate visual Entities mapping graphs

Installation
------------

[](#installation)

- add to your project as a composer dependency:

```
    // composer.json
    {
        // ...
        require: {
            // ...
            "onurb/doctrine-metadata-grapher": "~1.1"
        }
    }
```

### Use

[](#use)

Send an array of Doctrine ClassMetadata to the YUMLMetadataGrapher::generateFromMetadata() method
It returns the string to send to [YUML](http://yuml.me) to get the mapping graph from the api
If you're a symfony user, you should install onurb/doctrine-yuml-bundle which already uses this library adding a link into the dev toolbar. if you're Zend framework user, it is included into the DoctrineORMModule if you install zend-developer-tools

Go to this github repo for concrete examples of use to retrieve the array of ClassMetadata

- [here](https://github.com/Nono1971/doctrine-yuml-bundle)

\##Peronalize the display : Add notes, color your classes, hide or display fields description, hide specific or all entity column

Fully optional, you can display fieldds description, add color to your map or wwrite notes linked to a specific class. [![Colored Map with note](https://camo.githubusercontent.com/9e7e04b45f61cce3fd0e4830daa1d33bfb1a6fb106fb3a86c64ee1dbd41f2bbf/687474703a2f2f79756d6c2e6d652f3233653334616330)](http://yuml.me/23e34ac0)

To do this, the library provides few Doctrine Annotations, to define color, to add notes, to hide or show attributes properties or display specific methods in the graph All of them are described below

Options use
-----------

[](#options-use)

### Display fields description

[](#display-fields-description)

To display an Entity attributes properties, Use the @ShowAttributesProperties annotation on your entity :

[![Yuml Graphs](https://camo.githubusercontent.com/58da380331a3ae57188a1eefd1e460eb4657895be6227b105f31cd6e3ea301b1/687474703a2f2f79756d6c2e6d652f3562396430633662)](http://yuml.me)

```
[...]
use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;
/**
* @Grapher\ShowAttributesProperties
* @ORM\Entity
*/
Class MyEntity
{
    //[...]
}
```

It il also possible to show properties on all Entities and hide it only on less important Entities

```
    /**
     * @param ClassMetadata[] $metadata
     * @param boolean $showFieldsDescription
     * @param array $colors
     * @param array $notes
     * @return string
     */
    public function generateFromMetadata(
        array $metadata,
        $showFieldsDescription = false,
        $colors = array(),
        $notes = array()
    )
```

To show fields descriptions just turn the $showFieldsDescription to true

```
    $metadataGrapher = new \Onurb\Doctrine\ORMMetadataGrapher\YumlMetadataGrapher();
    $dsl_text = $metadataGrapher->generateFromMetadata($classMetadata, true);
```

It is also possible to hide One Entity (or more) using the @HideAttributesProperties annotation (if $showFieldsDescription turned to true : no effect if false)

```
/**
* @Grapher\HideAttributesProperties
*/
MyEntity
{
    //[...]
}
```

Hide Entity columns with annotations : using the @grapher\\HideColumns annotation on the class :

```
/**
* @Grapher\Hidecolumns
*/
MyEntity
{
    //[...]
}
```

Or hide a specific secret column you want to hide, using the @Grapher\\HiddenColumn on the Entity attribute : can be usefull to hide you credential logic, or to avoid recurrent fields, like created\_at, or updated\_at in the graph.

```
MyEntity
{
    /**
     * @ORM\Column(/* ... */)
     * @Grapher\HiddenColumn
     */
    private $secret;
}
```

### Use colors

[](#use-colors)

you can use the yuml colors and apply it as you wish , on a class or on an entire namespace. color priority is given by hierarchy in the namespace...

#### Colors usage

[](#colors-usage)

The easiest way to define class color is to use annotations in Entities like this :

```
use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;
/**
* @Grapher\Color("blue")
*/
```

But doing it on each class can be boring if you want a complete namespace with the same color (to display a zend Module or a Symfony bundle with a specific color for example).

So it is also possible to define default color on namespaces, but not with annotations, only applied on entities.

It is done using the third argument of generateMetadata() method to inject an associated array. Color priority is given to Annotations, user can define a color for the namespace, and specifics colors for classes he want to highlight. It can be passed by parameters options depending of your framework logic to allow final users customization

```
    // [...]
    $defaultColors = array(
        'MyModule\\Project\Namespace\FunctionalityOne => 'green,
        'MyModule\\Project\Namespace\FunctionalityTwo => 'red,
        'AnotherModule\\Namespace' => 'violet',
    );
    $dsl_text = $metadataGrapher->generateFromMetadata($classMetadata, false, $defaultColors);
```

A complete list of available colors can be found [here](http://yuml.me/69f3a9ba.svg)[![Color list](https://camo.githubusercontent.com/3829c63d0f31c06a2c2a3f8457c07fd32b251e3d7d3542aedd16a4c2f20a1ff2/687474703a2f2f79756d6c2e6d652f36396633613962612e737667)](http://yuml.me/69f3a9ba.svg)

### Display methods

[](#display-methods)

Final user can display any method he wants in the graph, simply adding an annotation
[![Class With Methods](https://camo.githubusercontent.com/8bd88ef11070e732b8135cf153b223b04849fb3b1c58a51f9dc0c1172ff9f0fa/687474703a2f2f79756d6c2e6d652f3832623036366539)](http://yuml.me/82b066e9)

```
use use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;

// [...]
/**
* @Grapher\IsDisplayedMethod()
*/
public function myImportantMethod()
{}
```

### Add notes

[](#add-notes)

You can now add a note linked in the mapping to an Entity [![Note graph](https://camo.githubusercontent.com/9a5c147d6effe372421a8d039ebb1221f080db09c7cfccaf57d1097e7c45b2c9/687474703a2f2f79756d6c2e6d652f3832346333313833)](http://yuml.me/824c3183)

#### Notes usage

[](#notes-usage)

Notes are managed by annotations declared directly on classes to note:

```
use Doctrine\ORM\Mapping as ORM;
use Onurb\Doctrine\ORMMetadataGrapher\Mapping as Grapher;
/**
* @Grapher\Note("My first Entity note")
* @ORM\Entity
*/
class MyEntity{}
```

Note color is yellow by default... Maybe because of post-it color... My choice ;)

you can customize it like this :

```
/**
* @Grapher\Note(value="An Entity note", color="a_great_yuml_color")
*/
```

As we did with colors, you can also inject an array of notes in the generateMetadata method, but it is useless with annotations =&gt; we don't put notes on namespaces, only Entities.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~45 days

Recently: every ~78 days

Total

14

Last Release

3051d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84c2f5210c5e434d74b58a542153023975d6ae32768e0f9449d471f4b4fb5663?d=identicon)[nono1971](/maintainers/nono1971)

---

Top Contributors

[![Nono1971](https://avatars.githubusercontent.com/u/5521060?v=4)](https://github.com/Nono1971 "Nono1971 (41 commits)")[![vitek499](https://avatars.githubusercontent.com/u/1543645?v=4)](https://github.com/vitek499 "vitek499 (1 commits)")

---

Tags

ormdoctrinemetadatadiagramyumlgrapher

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/onurb-doctrine-metadata-grapher/health.svg)

```
[![Health](https://phpackages.com/badges/onurb-doctrine-metadata-grapher/health.svg)](https://phpackages.com/packages/onurb-doctrine-metadata-grapher)
```

###  Alternatives

[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8385.5M96](/packages/laravel-doctrine-orm)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58725.2M48](/packages/scienta-doctrine-json-functions)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1155.2k](/packages/rcsofttech-audit-trail-bundle)[api-platform/doctrine-orm

Doctrine ORM bridge

263.9M78](/packages/api-platform-doctrine-orm)[onurb/doctrine-yuml-bundle

Symfony Bundle to visualize the mapping of your entities with Yuml

4199.2k](/packages/onurb-doctrine-yuml-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
