PHP Classes

File: docs/

Recommend this page to a friend!
  Classes of jawira   PlantUML client   docs/   Download  
File: docs/
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PlantUML client
Convert a UML diagram to an image using PlantUML
Author: By
Last change:
Date: 6 months ago
Size: 1,494 bytes


Class file image Download

Available formats

The following formats are supported: png (default), svg, eps, txt, and latex.

Each format has its own class constant in \Jawira\PlantUmlClient\Formats.

You can get all available formats with \Jawira\PlantUmlClient\Formats::ALL.

Customizing PlantUML server

Currently, _PlantUML client_ uses the official server: <>. You can set your own _PlantUML server_ -for example for privacy purposes.

Set the server on instantiation:

use Jawira\PlantUmlClient\Client;
$client = new Client('');

Or, set the server after instantiation:

use Jawira\PlantUmlClient\Client;
$client = new Client(); // using default server

TIP: you can find plenty of open PlantUML servers with a simple search.

Generating image's url

This library only provides the minimum functionality to convert diagrams into images. If you need to do something more fancy (eg. async), you can retrieve the image's url and do it yourself.

Generating the image's url can also be useful for websites, for example.

use Jawira\PlantUmlClient\Client;
use Jawira\PlantUmlClient\Format;

$puml = <<<PLANTUML
Bob -> Alice : hello

$client = new Client();
$url = $client->generateUrl($puml, Format::PNG);

echo "<img src='$url'>";