jawira/plantuml-encoding

PlantUML text encoding functions

v1.0.8 2020-10-01 08:56 UTC

This package is auto-updated.

Last update: 2020-10-01 08:59:10 UTC


README

This library exposes PlantUML text encoding functions:

  • encodep()
  • encode6bit()
  • append3bytes()
  • encode64()

ℹ️ Usually only encodep() is used.

Latest Stable Version Total Downloads License composer.lock .gitattributes Issues

Purpose

PlantUML uses a special encoding to transform an uml text description like this:

@startuml
Bob -> Alice : hello
@enduml

into this:

SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

The advantage of the last encoding is that it is easier to use in URL:

http://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000

Usage

You must import encodep() function before using it:

<?php
require './vendor/autoload.php';

use function Jawira\PlantUml\encodep;

$encode = encodep('Alice -> Bob: hello');
echo "http://www.plantuml.com/plantuml/uml/{$encode}";

⚠️ Since v1.0.0, encodep() function expects to receive an UTF-8 string.

💡 Only PHP >=5.6 allows importing functions, for PHP <=5.5 you have to use full function's namespace.

More examples:

Install

$ composer require jawira/plantuml-encoding

Contributing

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

Credits

These functions are a copy/paste from http://plantuml.com/code-php.

Packages from jawira

jawira/plantuml GitHub stars
Provides PlantUML executable and plantuml.jar
jawira/phing-open-task Gitlab stars
Phing task to open files, directories, and URLs with your favorite software.
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.
jawira/emoji-catalog GitHub stars
Get access to +3000 emojis as class constants.
more...