Download the PHP package jbzoo/mermaid-php without Composer
On this page you can find all versions of the php package jbzoo/mermaid-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jbzoo/mermaid-php
More information about jbzoo/mermaid-php
Files in jbzoo/mermaid-php
Package mermaid-php
Short Description Generate diagrams and flowcharts with the help of the mermaid script language
License MIT
Informations about the package mermaid-php
JBZoo / Mermaid-PHP
A powerful PHP library for generating Mermaid diagrams programmatically. Create flowcharts, ER diagrams, class diagrams, and timelines with a fluent, object-oriented API.
Table of Contents
- Installation
- Requirements
- Features
- Quick Start
- Diagram Types
- Flowcharts/Graphs
- ER Diagrams
- Class Diagrams
- Timeline Diagrams
- Sequence Diagrams
- Output Formats
- Development
- License
- Related Projects
Installation
Install via Composer:
Requirements
- PHP 8.3 or higher
- ext-json
Features
✅ Multiple Diagram Types: Flowcharts, ER diagrams, class diagrams, sequence 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
Diagram Types
Flowcharts/Graphs
Create complex flowcharts with nodes, links, and subgraphs:
Result
Clickable nodes
Attach a hyperlink (with an optional tooltip and target) to any node; it renders as a Mermaid click directive:
setUrl() alone is enough; setTooltip() and setTarget() (Node::TARGET_BLANK, TARGET_SELF,
TARGET_PARENT, TARGET_TOP) are optional.
Per-link styles
Give an individual link its own CSS; it renders as a linkStyle <index> ... directive. The index is resolved
automatically from the link's position in the whole graph (sub-graphs and abc_order included):
The same CSS can be passed through the id-based helper: $graph->addLinkByIds('A', 'B', '', Link::ARROW, 'stroke:blue');.
ER Diagrams
Build entity-relationship diagrams for database schemas:
Result
Timeline Diagrams
Create timeline visualizations for chronological data:
Result
Class Diagrams
Generate UML class diagrams with relationships, namespaces, and cardinality:
Result
Sequence Diagrams
Produces:
Output Formats
All diagram types support multiple output formats:
Mermaid Syntax
HTML with Embedded Viewer
Self-Hosting & Offline (GDPR)
By default the generated page imports Mermaid from a public CDN. When the browser opens the page it sends the visitor's IP to that third party, which can be a GDPR concern and also prevents fully offline rendering. (The old builds also loaded jQuery from a CDN — that dependency has been removed entirely, the generated page is now jQuery-free.)
Use the mermaid descriptor to control how Mermaid is loaded. It binds the build flavor to its source,
so there is a single, unambiguous option instead of guessing ESM vs UMD from a URL:
Notes:
umd-urlandumd-inlinerequire the standalone UMD build (mermaid.min.js), which is a single self-contained file. The ESM build (mermaid.esm.min.mjs) is only a loader that fetches per-diagram chunks over the network at render time, so it cannot be self-hosted as one file or inlined.- The library does not vendor Mermaid — download
mermaid.min.jsyourself (npm, or from the CDN) and pointsourceat it. Nothing is fetched over the network by PHP during rendering. - "Offline" caveats: inlining removes Mermaid's own requests, but
fa:Font Awesome icons and custom web fonts are not embedded by Mermaid; provide them locally too if you need a provably request-free page.
Live Editor URL
Development
Setup
Testing
- Unit Tests: PHPUnit tests in
tests/directory - Code Coverage: Available via
make report-all - Static Analysis: Psalm integration for type safety
Useful Links
- Mermaid Documentation - Official Mermaid.js documentation
- Mermaid Live Editor - Online editor for testing diagrams
- Mermaid on GitHub - Source code and issues
License
MIT
Related Projects
- CI-Report-Converter - Converting different error reports for deep compatibility with popular CI systems.
- Composer-Diff - See what packages have changed after
composer update. - Composer-Graph - Dependency graph visualization of composer.json based on mermaid-js.
- Utils - Collection of useful PHP functions, mini-classes, and snippets for every day.
- Image - Package provides object-oriented way to manipulate with images as simple as possible.
- Data - Extended implementation of ArrayObject. Use files as config/array.
- Retry - Tiny PHP library providing retry/backoff functionality with multiple backoff strategies and jitter support.
- SimpleTypes - Converting any values and measures - money, weight, exchange rates, length, ...
All versions of mermaid-php with dependencies
ext-json Version *