1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/vendor/graphp/graphviz/examples/02-html.php
2023-02-17 11:42:45 -03:00

25 lines
513 B
PHP

<?php
// $ php -S localhost:8080 examples/02-html.php
require __DIR__ . '/../vendor/autoload.php';
$graph = new Fhaculty\Graph\Graph();
$graph->setAttribute('graphviz.graph.rankdir', 'LR');
$hello = $graph->createVertex('hello');
$world = $graph->createVertex('wörld');
$hello->createEdgeTo($world);
$graphviz = new Graphp\GraphViz\GraphViz();
$graphviz->setFormat('svg');
echo '<!DOCTYPE html>
<html>
<head>
<title>hello wörld</title>
<body>
' . $graphviz->createImageHtml($graph) . '
</body>
</html>
';