PHPackages                             badams/graphviz - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. badams/graphviz

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

badams/graphviz
===============

Temporary fork of alom/graphviz

v1.1.0.3(8y ago)11.3k↓50%MITPHPPHP &gt;=5.3.0

Since May 10Pushed 8y agoCompare

[ Source](https://github.com/badams/graphviz)[ Packagist](https://packagist.org/packages/badams/graphviz)[ Docs](http://github.com/alexandresalome/graphviz)[ RSS](/packages/badams-graphviz/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (11)Used By (0)

Graphviz
========

[](#graphviz)

[![Build status](https://camo.githubusercontent.com/837896aa432b0021feb0445282f32812caf8cd022823132a82ffb82b840eb8f9/68747470733a2f2f7472617669732d63692e6f72672f616c6578616e64726573616c6f6d652f677261706876697a2e706e673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/837896aa432b0021feb0445282f32812caf8cd022823132a82ffb82b840eb8f9/68747470733a2f2f7472617669732d63692e6f72672f616c6578616e64726573616c6f6d652f677261706876697a2e706e673f6272616e63683d6d6173746572) [![Latest Stable Version](https://camo.githubusercontent.com/b88d2fcdffdc7482fa89a08f2d68fc3fa8861a4c4203ed909283b46ac775b540/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6d2f677261706876697a2f762f737461626c65)](https://packagist.org/packages/alom/graphviz) [![Total Downloads](https://camo.githubusercontent.com/b9025c3f75ebd952caa54732a14c9f634e66a9607e431210df1029a1957f99cd/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6d2f677261706876697a2f646f776e6c6f616473)](https://packagist.org/packages/alom/graphviz) [![License](https://camo.githubusercontent.com/e0ed3097017fad95e89945c0232ae2153721bac35f2afb39251a9b455e2db3ff/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6d2f677261706876697a2f6c6963656e7365)](https://packagist.org/packages/alom/graphviz) [![Monthly Downloads](https://camo.githubusercontent.com/3c82d91bcf0638829d659c85e3dcdbedee3cbf844b537f0f7a415fbd3b3de6bc/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6d2f677261706876697a2f642f6d6f6e74686c79)](https://packagist.org/packages/alom/graphviz) [![Daily Downloads](https://camo.githubusercontent.com/97b4622474bc29bd740d66ed3c816c2df73450ec355a913d1a3c8ae4f6298199/68747470733a2f2f706f7365722e707567782e6f72672f616c6f6d2f677261706876697a2f642f6461696c79)](https://packagist.org/packages/alom/graphviz)

Graphviz generation for PHP

- [View CHANGELOG](CHANGELOG.md)
- [View CONTRIBUTORS](CONTRIBUTORS.md)

[![Build Status](https://camo.githubusercontent.com/f3406207e8dad2de318c34339cd6f3d02e306193109c777518062022cc1800e2/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f616c6578616e64726573616c6f6d652f677261706876697a2e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/alexandresalome/graphviz)

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

[](#installation)

Install the latest version with:

```
composer require alom/graphviz
```

Usage
-----

[](#usage)

This library allow you to create Dot Graph with a PHP fluid interface:

```
$graph = new Alom\Graphviz\Digraph('G');
$graph
    ->subgraph('cluster_1')
        ->attr('node', array('style' => 'filled', 'fillcolor' => 'blue'))
        ->node('A')
        ->node('B')
        ->edge(array('b0', 'b1', 'b2', 'b3'))
    ->end()
    ->edge(array('A', 'B', 'C'))
;
echo $graph->render();
```

### Escaping of labels

[](#escaping-of-labels)

By default, labels will be escaped, so that your PHP string is represented "as it is" in the graph. If you don't want the label to be escaped, add set the special **\_escaped** attribute to false:

```
$graph = new Alom\Graphviz\Digraph('G');
$graph
    ->node('my_table', array(
        'label' => '',
        '_escaped' => false
    ))
```

### Browsing the graph

[](#browsing-the-graph)

When you have created lot of subgraphs and nodes, it might be useful to be able to browse it using identifiers. For example, if you have the following graph:

```
$graph = new Alom\Graphviz\Digraph('G');
$graph
    ->subgraph('cluster_1')
        ->node('A')
        ->node('B')
    ->end()
    ->subgraph('cluster_2')
        ->node('C')
        ->node('D')
    ->end()
    ->edge(array('C', 'D'))
;
```

You can do the following to access the nodes in the existing graph:

```
$cluster = $graph->get('cluster_1');
$node = $graph->get('cluster_2')->get('D');
```

When you have a node or an edge, you can manipulate its attributes:

```
# read a value
echo $node->getAttribute('label', 'no label'); # second argument is default value

# write a value
$node->attribute('label', 'new label');
```

On a graph, you can access or verify edge existence:

```
$graph->hasEdge(array('A', 'B'));
$graph->getEdge(array('C', 'D'));

```

### Using cluster and record IDs

[](#using-cluster-and-record-ids)

If you create an edge from/to an ID inside a record, use an array instead of a string:

```
$graph = new Alom\Graphviz\Digraph('G');
$graph
    ->node('A', array('shape' => 'record', 'label' => '{  Part 1 |  Part 2}'))
    ->node('B')
    ->edge(array('B', array('A', '1')))
;
```

As you can see in the example above, the edge is composed of two parts:

- `'B'`: a regular node
- `array('A', '1')`: targets the cell "1" inside the A node

This method also work for **getEdge**, **hasEdge** and every edge-related method.

Samples
-------

[](#samples)

Take a look at examples located in **samples** folder:

- [00-readme.php](samples/00-readme.php): Example from graphviz README
- [01-basic.php](samples/01-basic.php): Basic styling of nodes
- [02-table.php](samples/02-table.php): An example for HTML table escaping

You can generate any of those graph by using the following commands:

```
php samples/00-readme.php | dot -Tpdf -oout.pdf
xdg-open out.pdf
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~304 days

Recently: every ~286 days

Total

6

Last Release

3234d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fe4edc8748b6ac4922ab8d16f64de61ad0b552027d8c1630646f6a0d6f09b9d?d=identicon)[badams](/maintainers/badams)

---

Top Contributors

[![AurelC2G](https://avatars.githubusercontent.com/u/797407?v=4)](https://github.com/AurelC2G "AurelC2G (1 commits)")[![clemens-tolboom](https://avatars.githubusercontent.com/u/371014?v=4)](https://github.com/clemens-tolboom "clemens-tolboom (1 commits)")[![odolbeau](https://avatars.githubusercontent.com/u/680206?v=4)](https://github.com/odolbeau "odolbeau (1 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (1 commits)")[![petsagouris](https://avatars.githubusercontent.com/u/277956?v=4)](https://github.com/petsagouris "petsagouris (1 commits)")

---

Tags

dotgraphviz

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/badams-graphviz/health.svg)

```
[![Health](https://phpackages.com/badges/badams-graphviz/health.svg)](https://phpackages.com/packages/badams-graphviz)
```

###  Alternatives

[dflydev/dot-access-data

Given a deep data structure, access data by dot notation.

718359.1M86](/packages/dflydev-dot-access-data)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[graphp/graphviz

GraphViz graph drawing for the mathematical graph/network library GraPHP.

3232.1M49](/packages/graphp-graphviz)[alom/graphviz

Graphviz generation for PHP

74651.4k9](/packages/alom-graphviz)[innmind/object-graph

Extract object graph out of a root object

242.8k7](/packages/innmind-object-graph)[flow-php/array-dot

PHP ETL - Array Dot functions

14374.1k3](/packages/flow-php-array-dot)

PHPackages © 2026

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