Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

PlantUml wrapper to convert puml diagrams to images.

License

NotificationsYou must be signed in to change notification settings

jawira/plantuml-to-image

Repository files navigation

PlantUml wrapper to convert.puml diagrams into images.

Latest Stable VersionTotal DownloadsPHP Version RequireLicense

Usage

This package provides three methods:

  1. \Jawira\PlantUmlToImage\PlantUml::convertTo
  2. \Jawira\PlantUmlToImage\PlantUml::setJar
  3. \Jawira\PlantUmlToImage\PlantUml::isPlantUmlAvailable

Convert .puml diagram to image

It's up to you to load your diagram from disk, thenuse\Jawira\PlantUmlToImage\PlantUml to convert the diagram to another format,after conversion, it's up to you to save new image to disk:

useJawira\PlantUmlToImage\Format;useJawira\PlantUmlToImage\PlantUml;// Load diagram$puml =file_get_contents('./diagram.puml');// Convert to png$plantUml =newPlantUml();$png =$plantUml->convertTo($puml, Format::PNG);// Save diagramfile_put_contents('./diagram.png',$png);

Set Jar location

Specify the location ofplantuml.jar:

$plantUml->setJar('/path/to/plantuml.jar');

You don't need to set Jar location in the following cases:

  1. You have downloaded PlantUMLwithjawira/plantuml, (locationvendor/jawira/plantuml/bin/plantuml.jar).
  2. If you have installed PlantUML with apt-get(location/usr/share/plantuml/plantuml.jar).
  3. Or if you haveplantuml command installed.

Check PlantUml availability

An exception is thrown when jar can't be found, use this method to avoid theexception.

if ($plantUml->isPlantUmlAvailable()) {echo'PlantUml is available.',PHP_EOL;}else {echo'Sorry, cannot convert diagram.',PHP_EOL;}

How to install

$composer require jawira/plantuml-to-image

Requirements

This package needsPlantUml (https://plantuml.com/en/download) as anexecutable or as a Jar file, note thatPlantUmlhas its own requirements (https://plantuml.com/en/starting).

As an alternative, you can installPlantUml with Composer:

$composer require jawira/plantuml

Contributing

If you liked this project,⭐star it on GitHub.

License

This library is licensed under theMIT license.


Packages from jawira

jawira/doctrine-diagram-bundleGitHub stars
Symfony Bundle to generate database diagrams.
jawira/case-converterGitHub stars
Convert strings between 13 naming conventions: Snake case, Camel case, Pascal case, Kebab case, Ada case, Train case, Cobol case, Macro case, Upper case, Lower case, Sentence case, Title case and Dot notation.
more...

[8]ページ先頭

©2009-2025 Movatter.jp