PHP code example of jonaspardon / mermaid-php

1. Go to this page and download the library: Download jonaspardon/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/ */

    

jonaspardon / mermaid-php example snippets


$graph = new Graph(new GraphDirection(GraphDirection::LEFT_TO_RIGHT));

$from = new Node(
    identifier: 'A',
    title: 'This package',
    shape: new NodeShape(NodeShape::ROUND_EDGES),
    style: new Style(
        backgroundColor: '#16a085',
        fontColor: '#ffffff',
        borderColor: '#333333',
    ),
);

$to = new Node(
    identifier: 'B',
    title: 'Your application',
    shape: new NodeShape(NodeShape::HEXAGON),
    style: new Style(
        backgroundColor: '#55efc4',
        fontColor: '#000',
        borderColor: '#333333',
    ),
);

$link = new Link($from, $to);

$output = $graph->addNode($from)
    ->addNode($to)
    ->addLink($link)
    ->render();
bash
composer