Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Mermaid Flowchart documentation
Logo
Mermaid Flowchart documentation

Contents

  • Installation
  • Usage
  • API
    • Flowchart Class
    • EdgeId Class
    • Link Class
    • Node Class
    • SubGraph Class
    • Enums
Back to top
View this page

Link Class¶

class Link¶

Represents a Link between two node(s) and/or sub-graph(s)

__construct(LinkableInterface $from, LinkableInterface $to, LinkStyle $style = LinkStyle::solid, int $minLength = 1, ArrowHead $arrowHead = ArrowHead::arrow)¶

Creates a Link between two node(s) and/or sub-graph(s)

Parameters:
  • $from (LinkableInterface) – The object the link is from

  • $to (LinkableInterface) – The object the link is to

  • $style (LinkStyle) – The link style (default: LinkStyle::solid)

Note

The remaining parameters are ignored if $style === LinkStyle::invisible

Parameters:
  • $minLength (int) – The minimum link length (default: 1)

  • $arrowHead (ArrowHead) – The link’s arrowhead (default: ArrowHead::arrow)

  • $biDirection (bool) – Whether the link is bidirectional (default: unidirectional)

Returns:

A new instance of Link

Return type:

Link

bidirectional()¶

Make the link bidirectional

Returns:

A new instance of Link that is bidirectional

Return type:

Link

Throws:

RuntimeException on render if $style === LinkStyle::invisible

withEdgeId(EdgeId $edgeId)¶

Sets an edge id

Parameters:
  • $edgeId (EdgeId) – The edge id

Returns:

A new instance of Link that has an edge id

Return type:

Link

Throws:

RuntimeException on render if $style === LinkStyle::invisible

withText(string $text)¶

Add text to the link

Parameters:
  • $text (string) – The text

Returns:

A new instance of Link with the text

Return type:

Link

Throws:

RuntimeException on render if $style === LinkStyle::invisible

Next
Node Class
Previous
EdgeId Class
Copyright © 2026, BeastBytes
Made with Sphinx and @pradyunsg's Furo
On this page
  • Link Class
    • Link
      • Link::__construct()
      • Link::bidirectional()
      • Link::withEdgeId()
      • Link::withText()