Product Decisions This Supports
- Docs-as-code for architecture and flows.
jbzoo/mermaid-php lets PHP/Laravel code emit Mermaid diagram source (flowcharts, sequence, ER, state, class diagrams) as plain text. That makes diagrams reviewable in PRs and versioned with the code they describe, rather than living in stale screenshots or a wiki.
- Living documentation. You can derive diagrams from the source of truth — Eloquent models for ERDs, route definitions for request flows, state machines/workflows for process diagrams, queue/job graphs for async pipelines — and regenerate them on demand. This is a documentation-drift fix, not just a diagram tool.
- Build vs. buy decision: adopt, don't build. MIT-licensed and narrow in scope. It replaces a small internal DSL or a pile of hand-maintained diagram images with a maintained dependency. The alternative — building your own Mermaid emitter — is low-value engineering work.
- Product features it can unlock. "Export workflow diagram" in an admin/reporting surface; customer-facing process visualizations (onboarding, approval chains, order lifecycles); generated dependency maps for platform teams; auto-generated diagrams attached to release notes or support docs.
- Roadmap input. CI job that regenerates diagrams on merge and fails on drift; onboarding packs for new engineers; per-tenant or per-configuration architecture snapshots. Each is a small, bounded scope item rather than a platform bet.
- Use cases to prioritize. Internal engineering docs (highest value, lowest risk), support/ops runbooks, and customer-facing process diagrams (only where Mermaid's rendering constraints are acceptable).
When to Consider This Package
Consider it when:
- The codebase is PHP/Laravel and diagram generation naturally lives alongside models, services, or Artisan commands.
- Your team already uses Mermaid in Markdown (GitHub, GitLab, Notion, Confluence plugins, docs sites) and wants diagrams generated, not drawn.
- You want text-based, diffable, version-controlled diagram artifacts instead of binary images.
- You need diagram source generation, not rendering — you're comfortable rendering via existing Mermaid tooling (browser,
mermaid-cli, CI docs pipeline).
- The dependency sits on a non-critical path (docs, internal tooling, exports) where a small community package is acceptable.
Look elsewhere when:
- You need server-side rendered PNG/SVG at scale — use
mermaid-cli/Node or a rendering service; this package generates syntax, it does not render pixels.
- The requirement is in a critical runtime path with uptime/SLA expectations. At 49 stars and a single-maintainer profile, the bus factor argues against that.
- The team is non-PHP or diagrams are better produced by a design/GUI tool (Miro, Lucid, Figma) where non-engineers edit them.
- You need advanced styling, interactivity, or layouts beyond what Mermaid itself supports — the package inherits Mermaid's limits.
- You require vendor support, security review artifacts, or long-term maintenance guarantees.
Adoption guardrails: pin the version, wrap it behind a thin internal interface (e.g., a DiagramGenerator service), and keep the output as strings so you can swap the emitter later without touching call sites.
How to Pitch It (Stakeholders)
For executives: This is a small, MIT-licensed PHP library that turns our application code into Mermaid diagram text, so architecture and process diagrams get generated and versioned like code instead of hand-drawn and left to go stale. Cost is effectively zero, scope is contained to documentation and internal/export tooling, and it does not touch production request paths. The main caveat is maturity — it's a small open-source project — so we'd wrap it and pin it, keeping an exit path.
For engineering: Composer-installable, no runtime infrastructure. Use it in Laravel to emit Mermaid syntax from models, services, or Artisan commands; render with the Mermaid tooling we already have (GitHub/GitLab Markdown, docs site, mermaid-cli in CI). The output is just a string, so it's easy to test and easy to replace. Be explicit about the boundary: it generates diagram source, it does not render images. Because the project is small (49 stars, limited maintainer base), we isolate it behind an internal interface, pin the version, and treat it as a docs-tooling dependency rather than platform infrastructure.