beastbytes / mermaid-mindmap
PHP for Mermaid.js mindmaps
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/beastbytes/mermaid-mindmap
Requires
- php: ^8.3
- beastbytes/mermaid: dev-master
Requires (Dev)
- pestphp/pest: ^4.0
- vimeo/psalm: ^6.0
This package is auto-updated.
Last update: 2025-12-29 22:44:41 UTC
README
PHP for Mermaid.js mindmaps.
For license information see the LICENSE file.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist beastbytes/mermaid-mindmap
or add
"beastbytes/mermaid-mindmap": "{{versionConstraint}}"
to the require section of your composer.json.
Usage
- Create and configure a root
Nodeinstance - Add child nodes to the root node
- Nodes can be nested to any level
- Create a
Mindmapinstance usingMermaid::create() - Add the root node to the
Mindmapinstance - Render the
Mindmapinstance
API
Mindmap
Represents a Mindmap diagram.
withComment
Returns a new instance of Mindmap with a comment.
Parameters
| Name | Type | Description |
|---|---|---|
| comment | string | The comment |
| Return Type: Mindmap |
withRootNode
Returns a new instance of Mindmap with a root node.
Parameters
| Name | Type | Description |
|---|---|---|
| root | Node | The root node |
| Return Type: Mindmap |
Node
Represents a node in Mindmap diagram.
__construct()
Returns a new instance of Node.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| id | ?string | The node id Used as the node text if withText() is not called |
null (auto-generated ID) |
| shape | ?NodeShape | The node shape | null |
| Return Type: Node |
addNode()
Returns a new instance of Node with the node(s) added to the existing child nodes.
Parameters
| Name | Type | Description |
|---|---|---|
| node | ...Node | Node(s) |
| Return Type: Node |
withComment()
Returns a new instance of Node with a comment.
Parameters
| Name | Type | Description |
|---|---|---|
| comment | string | The comment |
| Return Type: Node |
withIcon()
Returns a new instance of Node with an icon. The icon pack must be available on the page rendering the diagram.
Parameters
| Name | Type | Description |
|---|---|---|
| icon | string | The icon definition |
| Return Type: Node |
withNode()
Returns a new instance of Node with the child node(s).
Parameters
| Name | Type | Description |
|---|---|---|
| node | ...Node | Node(s) |
| Return Type: Node |
withStyleClass()
Returns a new instance of Node with the style class.
Parameters
| Name | Type | Description |
|---|---|---|
| styleClass | string | The style class |
| Return Type: Node |
withText()
Returns a new instance of Node with the node text.
If this method is not called, the node ID is used as the node text.
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The node text |
| Return Type: Node |