PHPackages                             cmcdota/php-graph-to-svg - 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. cmcdota/php-graph-to-svg

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

cmcdota/php-graph-to-svg
========================

Compiles SVG graph based on force-directed layout Fruchterman-Reingold Algorithm.

v1.0.7(3y ago)014Apache-2.0PHPPHP &gt;=7.4

Since Feb 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/cmcdota/php-graph-to-svg)[ Packagist](https://packagist.org/packages/cmcdota/php-graph-to-svg)[ RSS](/packages/cmcdota-php-graph-to-svg/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

PhpGraphToSvg - Force Directed Graph
====================================

[](#phpgraphtosvg---force-directed-graph)

[![Total Downloads](https://camo.githubusercontent.com/6982fa81c28339ee684fa7e12e22b4beeff2f8b127e209991a4c0d5db5de100a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636d63646f74612f7068702d67726170682d746f2d7376672e737667)](https://packagist.org/packages/cmcdota/php-graph-to-svg)[![Latest Stable Version](https://camo.githubusercontent.com/cfc1ae24fad46effc621d7625a590e7a33a69629aaea7745c98bddabfed35c1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636d63646f74612f7068702d67726170682d746f2d7376672e737667)](https://packagist.org/packages/cmcdota/php-graph-to-svg)

Simple realisation of Force-Directed [Fruchterman–Reingold algorithm](https://reingold.co/force-directed.pdf).

Special Thanks to [Philipp Kindermann](https://seafile.rlp.net/f/1f06c2943e114d429b48/).

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

[](#installation)

Install the latest version with

```
$ composer require cmcdota/php-graph-to-svg
```

Basic Usage
-----------

[](#basic-usage)

```
use Cmcdota\PhpGraphToSvg\Board;

//Describe Vertexes and their edges (links)
$vertexes = [
    0 => ['name' => '0', 'fill'=> '80ff80', 'edges' => [1]],
    1 => ['name' => '1','fill'=> 'c0c0c0', 'edges' => [2]],
    2 => ['name' => '2', 'edges' => [3]],
    3 => ['name' => '3', 'edges' => [1]],
    5 => ['name' => '5', 'edges' => [0]],
    6 => ['name' => '6', 'edges' => [5]],
    7 => ['name' => '7', 'edges' => [6,3]],
    8 => ['name' => '8', 'edges' => [6,7]],
    9 => ['name' => '9', 'edges' => [5]],
    10 => ['name' => '10', 'edges' => [9]],
    11 => ['name' => '11', 'edges' => [10,8]],
    12 => ['name' => '12', 'edges' => [9,11]],
];
$board = new Board($vertexes, $params);
echo "";
for ($i = 1; $i renderSVG();
    file_put_contents("step$i.svg", $svg);
    echo "";
    $board->calculateAndMove(10);
}
```

Results for Random
------------------

[](#results-for-random)

Start with random coordinates: [![Starting Position](Images/Variant1.png)](Images/Variant1.png)

Results: [![Result](Images/Variant1Finish.png)](Images/Variant1Finish.png)

Results for Circle
------------------

[](#results-for-circle)

```
$params=[
    'randomSpawn' => false
];
```

Start circle-ordered: [![Starting Position](Images/Circle1.png)](Images/Circle1.png)

Results: [![Result](Images/Circle1Finish.png)](Images/Circle1Finish.png)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

7

Last Release

1178d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb11b846bcaabdbc31662cceaac6b7e3084d8d6eb7d649fe05706ab8675342c1?d=identicon)[cmcdota](/maintainers/cmcdota)

---

Top Contributors

[![cmcdota](https://avatars.githubusercontent.com/u/5966281?v=4)](https://github.com/cmcdota "cmcdota (18 commits)")

---

Tags

phpsvggraphforce-directedFruchtermanReingoldFruchterman-Reingold

### Embed Badge

![Health badge](/badges/cmcdota-php-graph-to-svg/health.svg)

```
[![Health](https://phpackages.com/badges/cmcdota-php-graph-to-svg/health.svg)](https://phpackages.com/packages/cmcdota-php-graph-to-svg)
```

###  Alternatives

[benpickles/peity

Peity (sounds like deity) is a jQuery plugin that converts an element's content into a mini `&lt;svg&gt;` pie, donut, line or bar chart.

4.2k2.8k](/packages/benpickles-peity)[sdboyer/gliph

A graph library for PHP.

17029.1k1](/packages/sdboyer-gliph)[fab2s/nodalflow

A PHP Nodal WorkFlow

16362.4k1](/packages/fab2s-nodalflow)[tomloprod/radiance

A deterministic mesh gradient avatar generator for PHP.

1393.7k](/packages/tomloprod-radiance)[halfpastfouram/phpchartjs

PHP library for ChartJS

2512.2k](/packages/halfpastfouram-phpchartjs)

PHPackages © 2026

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