Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Guides Graphs Laravel Package

phpdocumentor/guides-graphs

Graph extension for phpDocumentor Guides that adds diagram/graph rendering support to your documentation. Generate visual graphs from source definitions and integrate them into Guides output as part of your build pipeline.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package via Composer:
    composer require --dev phpdocumentor/guides-graphs
    
  2. Ensure phpdocumentor/guides (v3+) is installed and configured β€” guides-graphs is a plugin for Guides, not a standalone tool.
  3. Define a graph in your markdown using the fenced code block syntax, e.g.:
    ```graphviz
    digraph G {
        A -> B;
        B -> C;
        A -> C [label="direct"];
    }
    ```
    
  4. Build your documentation using phpdocumentor guide:build. The graph will be automatically rendered (default: SVG) and embedded in the output.

πŸ’‘ First use case: Embed system architecture diagrams directly in your API docs to keep them in sync with code β€” update the DOT source, rebuild, and the diagram updates.

Implementation Patterns

  • Inline graphs in markdown files for tight coupling between docs and code (e.g., in reference/system-design.md).
  • Use theme_options.graphs.renderers in guide.yaml to configure renderer preferences or fallbacks:
    theme_options:
      graphs:
        renderers:
          graphviz:
            format: svg
            engine: dot
    
  • Leverage extensibility: Add custom renderers by registering services tagged with guides_graphs.renderer. Ideal for internal DSLs (e.g., plantuml, mermaid, or domain-specific diagram formats).
  • CI-friendly rendering: All renders are deterministic β€” use in CI to generate a consistent assets/graphs/ folder for deployment.
  • Theme-aware integration: Guides themes automatically pick up rendered outputs; no extra HTML or <img> tags needed β€” just the code block.

πŸ”„ Workflow tip: Start with Graphviz (DOT) for quick prototyping, then refactor complex diagrams to custom renderers as your docs mature.

Gotchas and Tips

  • ⚠️ Missing Graphviz binary? The default Graphviz renderer requires dot on $PATH. In containerized/CI builds, ensure it’s installed (apt-get install graphviz on Debian/Ubuntu).
  • ⚠️ SVG-only by default: If your theme or mobile audience prefers PNG, configure format: png and verify font rendering consistency (embed fonts if needed).
  • πŸ“ Output location: Rendered assets land in output/{theme}/assets/graphs/ by default β€” double-check this path aligns with your static host’s asset strategy.
  • πŸ”„ Incremental builds: Guides caches renders. Use --force to rebuild all graphs (e.g., when updating the DOT library or renderer config).
  • πŸ§ͺ Debug rendering issues:
    • Add --debug to the guide:build command to see renderer logs.
    • Temporarily disable caching in guide.yaml (cache: false).
  • πŸ”Œ Extension point: The GuidesGraphsExtension class is your entry for registering custom renderers β€” register services in services.yaml or a custom extension class.
  • 🧩 No native Mermaid support: Though the architecture supports it, you’ll need to write a custom renderer (see src/Renderer/GraphvizRenderer for reference).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation