Flowchart Class

class Flowchart

Represents a Flowchart diagram

addEdge(Edge ...$edge)

Add edge(s)

Parameters:
  • ...$edge (Edge) – The edge(s)

Returns:

A new instance of Flowchart with the edge(s) added

Return type:

Flowchart

addNode(Node ...$node)

Add node(s) and/or sub-graphs

Parameters:
  • ...$node (Node) – The node(s)

Returns:

A new instance of Flowchart with the node(s) added

Return type:

Flowchart

addSubGraph(SubGraph ...$subGraph)

Add sub-graph(s)

Parameters:
  • ...$subGraph (SubGraph) – The sub-graph(s)

Returns:

A new instance of Flowchart with the sub-graph(s) added

Return type:

Flowchart

render(array $attributes = [])

Renders the diagram

Parameters:
  • $attributes (array) –

    HTML attributes for the <pre> tag as name=>value pairs

    Note

    The mermaid class is added

Returns:

Mermaid diagram code in a <pre> tag

Return type:

string

withComment(string $comment)

Add a comment

Parameters:
  • $comment (string) – The comment

Returns:

A new instance of Flowchart with the comment

Return type:

Flowchart

withDirection(Direction $direction)

Set the flowchart direction

The default flowchart direction is Direction::TB

Parameters:
  • $direction) (Direction) – The direction

Returns:

A new instance of Flowchart with the direction

Return type:

Flowchart

withEdge(Edge ...$edge)

Set edge(s)

Parameters:
  • ...$edge (Edge) – The edge(s)

Returns:

A new instance of Flowchart with the edge(s)

Return type:

Flowchart

withNode(Node ...$node)

Set node(s)

Parameters:
  • ...$node (Node) – The node(s)

Returns:

A new instance of Flowchart with the node(s)

Return type:

Flowchart

withSubGraph(SubGraph ...$subGraph)

Set sub-graph(s)

Parameters:
  • ...$subGraph (SubGraph) – The sub-graph(s)

Returns:

A new instance of Flowchart with the sub-graph(s)

Return type:

Flowchart

withTitle(string $title)

Add a title

Parameters:
  • $title (string) – The title

Returns:

A new instance of Flowchart with the title

Return type:

Flowchart