PHPackages                             fucodo/mermaid - 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. fucodo/mermaid

ActiveNeos-package[Utility &amp; Helpers](/categories/utility)

fucodo/mermaid
==============

0.2.0(6mo ago)06MITPHP

Since Oct 23Pushed 6mo agoCompare

[ Source](https://github.com/fucodo/flow.mermaid)[ Packagist](https://packagist.org/packages/fucodo/mermaid)[ RSS](/packages/fucodo-mermaid/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

fucodo.mermaid — Mermaid rendering for Neos Flow
================================================

[](#fucodomermaid--mermaid-rendering-for-neos-flow)

This Flow package provides a small service and CLI commands to render Mermaid diagrams () to SVG using mermaid-cli (mmdc) with a Puppeteer configuration that can be controlled from Flow Settings.

Features
--------

[](#features)

- Render Mermaid definitions from files to SVG
- Programmatic rendering service for inline Mermaid strings
- CLI helper to bootstrap node dependencies and the headless browser
- Stores a Puppeteer config JSON under Data/Temporary/Mermaid/ for reproducible runs

Prerequisites
-------------

[](#prerequisites)

- Node.js and npm installed on the host where Flow runs
- Network access to install npm packages on first setup
- A Chromium/Chrome executable suitable for headless use
    - The package can install chrome-headless-shell via Puppeteer (recommended for portability)

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

[](#installation)

1. Ensure the package is available in your Flow distribution (DistributionPackages/fucodo.mermaid) and that composer autoload is up to date.
2. Run the install command to fetch node dependencies and a headless browser: `./flow mermaid:install`This performs, inside the package directory:
    - `npm install`
    - `npx puppeteer browsers install chrome-headless-shell`

Configuration
-------------

[](#configuration)

The package reads its Puppeteer configuration from Flow settings and writes it to Data/Temporary/Mermaid/puppeteer-config.json before each render.

Default settings (Configuration/Settings.yaml in this package):

```
fucodo:
  mermaid:
    # is written in the puppeteer config file to guide mermaid to the correct location of the browser
    puppeteer-config:
      executablePath: '/usr/bin/chromium'
      args: ['--no-sandbox']

```

Override in your project’s Configuration/Settings.yaml as needed. Common options:

- executablePath: absolute path to the Chromium/Chrome binary or chrome-headless-shell installed by Puppeteer
- args: array of Chromium flags, e.g. \['--no-sandbox', '--disable-gpu'\]

Usage
-----

[](#usage)

CLI rendering from a Mermaid file to SVG (stdout):

- Render file: `./flow mermaid:render /absolute/path/to/diagram.mmd > diagram.svg`

Programmatic rendering in PHP (e.g., in a Flow controller/service):

```
use fucodo\mermaid\Service\MermaidService;
use Neos\Flow\Annotations as Flow;

class MyService {
    /**
     * @Flow\Inject
     * @var MermaidService
     */
    protected $mermaidService;

    public function buildSvg(): string
    {
        $mermaid = "graph TD; A-->B; A-->C; B-->D; C-->D;";
        return $this->mermaidService->renderMermaidGraph($mermaid);
    }
}

```

Commands
--------

[](#commands)

- `mermaid:install`Fetches npm dependencies for mermaid-cli and installs a Chromium variant via Puppeteer that mmdc can drive. Run this after deployment or if dependencies changed.
- mermaid:render Reads the Mermaid source from and writes the resulting SVG to stdout.

How it works
------------

[](#how-it-works)

- MermaidService prepares a Puppeteer config JSON at Data/Temporary/Mermaid/puppeteer-config.json using the fucodo.mermaid.puppeteer-config settings.
- It invokes mermaid-cli (mmdc) located in this package’s node\_modules, using: {PackagePath}/node\_modules/.bin/mmdc --puppeteerConfigFile {config} -e svg -o {tmpOutput} &lt; {input}
- Output is an SVG string read from the temporary file and returned/printed.

Tips and troubleshooting
------------------------

[](#tips-and-troubleshooting)

- If rendering fails with browser launch errors, ensure the configured executablePath exists and is executable, or re-run ./flow mermaid:install to install chrome-headless-shell and then point executablePath to it.
- On Linux containers, you may need --no-sandbox in args. This is the default in the package settings.
- Make sure the Flow process user can write to Data/Temporary/.
- If mmdc is not found, re-run mermaid:install or ensure node\_modules exists under the package directory.

Paths used by the package
-------------------------

[](#paths-used-by-the-package)

- Puppeteer config JSON: Data/Temporary/Mermaid/puppeteer-config.json
- Temp input/output files: Data/Temporary/\*

License
-------

[](#license)

MIT

Credits
-------

[](#credits)

- Uses mermaid-cli ()
- Uses Puppeteer for headless Chromium
- Integrates with Neos Flow

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance67

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Total

2

Last Release

194d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c6681704a769ab93a20ba54d94054d0f3f1e81b99341e8cfa29d91f6d8f16fb?d=identicon)[kaystrobach](/maintainers/kaystrobach)

---

Top Contributors

[![kaystrobach](https://avatars.githubusercontent.com/u/1185776?v=4)](https://github.com/kaystrobach "kaystrobach (3 commits)")

### Embed Badge

![Health badge](/badges/fucodo-mermaid/health.svg)

```
[![Health](https://phpackages.com/badges/fucodo-mermaid/health.svg)](https://phpackages.com/packages/fucodo-mermaid)
```

###  Alternatives

[neos/neos

An open source Content Application Platform based on Flow. A set of core Content Management features is resting within a larger context that allows you to build a perfectly customized experience for your users.

116989.0k674](/packages/neos-neos)[neos/eel

The Embedded Expression Language (Eel) is a building block for creating Domain Specific Languages

122.0M27](/packages/neos-eel)[neos/form

Extensible and flexible API for building web forms

18853.0k40](/packages/neos-form)[neos/fusion-form

Fusion Form

19724.3k31](/packages/neos-fusion-form)[neos/media

The Media package

101.1M45](/packages/neos-media)[avency/neos-vardump

Neos VarDump Package

147.1k](/packages/avency-neos-vardump)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
