PHPackages                             ramnzys/commonmark-kroki - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. ramnzys/commonmark-kroki

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

ramnzys/commonmark-kroki
========================

Renders diagrams using kroki service with league/commonmark.

1.0.0(5y ago)2278MITPHP

Since Mar 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ramnzys/commonmark-kroki)[ Packagist](https://packagist.org/packages/ramnzys/commonmark-kroki)[ RSS](/packages/ramnzys-commonmark-kroki/feed)WikiDiscussions master Synced 1mo ago

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

Renders diagrams using [kroki](https://kroki.io) service with league/commonmark.
================================================================================

[](#renders-diagrams-using-kroki-service-with-leaguecommonmark)

A block renderer for [league/commonmark](https://github.com/thephpleague/commonmark) to render blocks using [yuzutech/kroki](https://github.com/yuzutech/kroki).

> **Kroki** provides a unified API with support for BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag, RackDiag), BPMN, Bytefield, C4 (with PlantUML), Ditaa, Erd, GraphViz, Mermaid, Nomnoml, PlantUML, SvgBob, UMLet, Vega, Vega-Lite and WaveDrom…​ and more to come!

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

[](#installation)

You can install the package via composer:

```
composer require ramnzys/commonmark-kroki
```

Usage
-----

[](#usage)

Create a custom CommonMark environment, and register the `KrokiExtension` as described in the [league/commonmark documentation](https://commonmark.thephpleague.com/1.5/customization/extensions/).

```
use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use Ramnzys\CommonmarkKrokiExtension\KrokiExtension;

$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new KrokiExtension());

$config = [];

$commonMarkConverter = new CommonMarkConverter($config, $environment);

$markdownContent = b
```
EOT;

$htmlContent= $commonMarkConverter->convertToHtml($markdownContent);

echo $htmlContent;
```

### Rendered HTML output

[](#rendered-html-output)

```

```

[![](https://camo.githubusercontent.com/aea17f137b1e55973116dae155db09d7bb84be1b818dcaa2fb44ce00be8c3e9b/68747470733a2f2f6b726f6b692e696f2f677261706876697a2f7376672f654a784c7955777653697a495543684f7a4333495356576f356c4941676b5264757953645a463237464243766c6773413133674b4a41)](https://camo.githubusercontent.com/aea17f137b1e55973116dae155db09d7bb84be1b818dcaa2fb44ce00be8c3e9b/68747470733a2f2f6b726f6b692e696f2f677261706876697a2f7376672f654a784c7955777653697a495543684f7a4333495356576f356c4941676b5264757953645a463237464243766c6773413133674b4a41)[![](https://camo.githubusercontent.com/44ab6465d8e7dffc5c789d383cee28cabb12aa0a250a4bddec7c848c286240c5/68747470733a2f2f6b726f6b692e696f2f706c616e74756d6c2f7376672f654a784c314c564c34674941424359424f51)](https://camo.githubusercontent.com/44ab6465d8e7dffc5c789d383cee28cabb12aa0a250a4bddec7c848c286240c5/68747470733a2f2f6b726f6b692e696f2f706c616e74756d6c2f7376672f654a784c314c564c34674941424359424f51)

### Configuration

[](#configuration)

The default configuration used by this extension is:

```
    $config = [
        'kroki' => [
            'server'    => 'https://kroki.io',
            'format'    => 'svg',
            'auto'      => ['plantuml']
        ]
    ];
```

ConfigDescriptionDefault valueserverSpecifies the server endpoint to be used for the diagram rendering. By default the public service is used, but kroki can be [self hosted/deployed](https://docs.kroki.io/kroki/setup/install/).`https://kroki.io`formatSpecifies the render output format. Supported format include svg, png, jpeg, pdf and base64. The output format available depends on the diagram type ().`svg`autoIn order to signal the extension to parse the content of the code block as a diagram, you have to specify the *language* of the code block to be `kroki:plantuml` (or any other diagram format suported: plantuml, graphviz, blockdiag, mermaid, etc). This option allow you to specify an array of *diagram types* that my be used directly as the *language*, ommiting the `kroki:` suffix as shown in the usage example.`['plantuml']`Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1892d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15c3bcf297fd2d9ed8ee3b15f0f5f0957c66b7793932af579ec5ce94d4a76fe2?d=identicon)[ramnzys](/maintainers/ramnzys)

---

Top Contributors

[![ramnzys](https://avatars.githubusercontent.com/u/19354043?v=4)](https://github.com/ramnzys "ramnzys (1 commits)")

---

Tags

commonmarkcommonmark-extensionkrokiplantumlmarkdowncommonmarkplantumldiagramskroki

### Embed Badge

![Health badge](/badges/ramnzys-commonmark-kroki/health.svg)

```
[![Health](https://phpackages.com/badges/ramnzys-commonmark-kroki/health.svg)](https://phpackages.com/packages/ramnzys-commonmark-kroki)
```

###  Alternatives

[torchlight/torchlight-commonmark

A Commonmark extension for Torchlight, the syntax highlighting API.

29256.6k6](/packages/torchlight-torchlight-commonmark)[zoon/commonmark-ext-youtube-iframe

Extension for league/commonmark to replace youtube link with iframe

12275.9k1](/packages/zoon-commonmark-ext-youtube-iframe)

PHPackages © 2026

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