承接 jawira/plantuml-to-image 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jawira/plantuml-to-image

最新稳定版本:v1.2.0

Composer 安装命令:

composer require jawira/plantuml-to-image

包简介

PlantUml wrapper to convert puml diagrams to images.

README 文档

README

PlantUml wrapper to convert .puml diagrams into images.

Latest Stable Version Total Downloads PHP Version Require License

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, then use \Jawira\PlantUmlToImage\PlantUml to convert the diagram to another format, after conversion, it's up to you to save new image to disk:

use Jawira\PlantUmlToImage\Format;
use Jawira\PlantUmlToImage\PlantUml;

// Load diagram
$puml = file_get_contents('./diagram.puml');

// Convert to png
$plantUml = new PlantUml();
$png = $plantUml->convertTo($puml, Format::PNG);

// Save diagram
file_put_contents('./diagram.png', $png);

Set Jar location

Specify the location of plantuml.jar:

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

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

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

Check PlantUml availability

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

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 needs PlantUml (https://plantuml.com/en/download) as an executable or as a Jar file, note that PlantUml has its own requirements (https://plantuml.com/en/starting).

As an alternative, you can install PlantUml with Composer:

$ composer require jawira/plantuml

Contributing

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

License

This library is licensed under the MIT license.

Packages from jawira

jawira/doctrine-diagram-bundle GitHub stars
Symfony Bundle to generate database diagrams.
jawira/case-converter GitHub 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...

统计信息

  • 总下载量: 15.39k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-14