PHP code example of bound1ess / mermaid-php

1. Go to this page and download the library: Download bound1ess/mermaid-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bound1ess / mermaid-php example snippets


use Bound1ess\MermaidPhp\Graph,
	Bound1ess\MermaidPhp\Printer,
	Bound1ess\MermaidPhp\Node,
	Bound1ess\MermaidPhp\Link;

$graph = new Graph('from left to right');

$graph->addNodes(
	$a = new Node('A', ['Hard edge']),
	$b = new Node('B', ['Round edge', Node::ROUND_EDGE]),
	$c = new Node('C', ['Decision', Node::RHOMBUS]),
	$d = new Node('D', ['Result one']),
	$e = new Node('E', ['Result two'])
);

$graph->addLinks(
	new Link($a, $b, 'Link text'),
	new Link($b, $c),
	new Link($c, $d, 'One'),
	new Link($c, $e, 'Two')
);

$code = (new Printer)->printGraph($graph);
shell
composer