PHPackages                             jbzoo/mermaid-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jbzoo/mermaid-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jbzoo/mermaid-php
=================

Generate diagrams and flowcharts with the help of the mermaid script language

7.2.6(3mo ago)471.1M↑12.7%13[1 PRs](https://github.com/JBZoo/mermaid-php/pulls)5MITPHPPHP ^8.2CI passing

Since Dec 12Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/JBZoo/mermaid-php)[ Packagist](https://packagist.org/packages/jbzoo/mermaid-php)[ RSS](/packages/jbzoo-mermaid-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (23)Used By (5)

JBZoo / Mermaid-PHP
===================

[](#jbzoo--mermaid-php)

[![CI](https://github.com/JBZoo/Mermaid-PHP/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Mermaid-PHP/actions/workflows/main.yml?query=branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/194d11389170e4a792a37350d62d2344a79b055b3e8624606eb58010b21295a0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4a425a6f6f2f4d65726d6169642d5048502f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/JBZoo/Mermaid-PHP?branch=master)[![Psalm Coverage](https://camo.githubusercontent.com/b3fb30058546964ea10fa35e736ac04189f811bc3739cfe7bbdab57cac03c4a1/68747470733a2f2f73686570686572642e6465762f6769746875622f4a425a6f6f2f4d65726d6169642d5048502f636f7665726167652e737667)](https://shepherd.dev/github/JBZoo/Mermaid-PHP)[![Psalm Level](https://camo.githubusercontent.com/69f936abba2ce576a1952c2f0e569865505e9c52c2618831df86c1b21ed2cb04/68747470733a2f2f73686570686572642e6465762f6769746875622f4a425a6f6f2f4d65726d6169642d5048502f6c6576656c2e737667)](https://shepherd.dev/github/JBZoo/Mermaid-PHP)[![CodeFactor](https://camo.githubusercontent.com/a17ad379a4156af5f5db6cd711370c9fd5a688b95355fbeb9aa82e810dd0ba4e/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f6a627a6f6f2f6d65726d6169642d7068702f6261646765)](https://www.codefactor.io/repository/github/jbzoo/mermaid-php/issues)

[![Stable Version](https://camo.githubusercontent.com/9a727140f442e0b059f9971f35d7467ba1ee5509b1f6f13f48c2b8e697f432f5/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f6d65726d6169642d7068702f76657273696f6e)](https://packagist.org/packages/jbzoo/mermaid-php/)[![Total Downloads](https://camo.githubusercontent.com/0ad6db81ee3607b2ca5891a404a43cb9649fe26ef61d89347a4eec989f035474/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f6d65726d6169642d7068702f646f776e6c6f616473)](https://packagist.org/packages/jbzoo/mermaid-php/stats)[![Dependents](https://camo.githubusercontent.com/6765cf6e51b1babe26010396191817c9bd768b706ce052a176181b6ef09ef861/68747470733a2f2f706f7365722e707567782e6f72672f6a627a6f6f2f6d65726d6169642d7068702f646570656e64656e7473)](https://packagist.org/packages/jbzoo/mermaid-php/dependents?order_by=downloads)[![GitHub License](https://camo.githubusercontent.com/b9d4d68a9e260805ce2603f54a0d8af76fe36e90851918678efe89e3fc93036f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a627a6f6f2f6d65726d6169642d706870)](https://github.com/JBZoo/Mermaid-PHP/blob/master/LICENSE)

A powerful PHP library for generating [Mermaid](https://mermaid.js.org/) diagrams programmatically. Create flowcharts, ER diagrams, class diagrams, and timelines with a fluent, object-oriented API.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Requirements](#requirements)
- [Features](#features)
- [Quick Start](#quick-start)
- [Diagram Types](#diagram-types)
    - [Flowcharts/Graphs](#flowchartsgraphs)
    - [ER Diagrams](#er-diagrams)
    - [Class Diagrams](#class-diagrams)
    - [Timeline Diagrams](#timeline-diagrams)
- [Output Formats](#output-formats)
- [Development](#development)
- [License](#license)
- [Related Projects](#related-projects)

Installation
------------

[](#installation)

Install via Composer:

```
composer require jbzoo/mermaid-php
```

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- ext-json

Features
--------

[](#features)

✅ **Multiple Diagram Types**: Flowcharts, ER diagrams, class diagrams, and timelines ✅ **Fluent API**: Intuitive method chaining for building complex diagrams ✅ **Multiple Output Formats**: Mermaid syntax, HTML with embedded viewer, live editor URLs ✅ **Theme Support**: Default, forest, dark, and neutral themes ✅ **Rich Customization**: Nodes, links, relationships, styling, and more ✅ **Type Safety**: Full PHP type hints and strict typing ✅ **Zero Dependencies**: Only requires PHP and ext-json

Quick Start
-----------

[](#quick-start)

```
