jawira/plantuml-encoding

PlantUML encoding functions

v1.0.7 2019-09-16 19:20 UTC

This package is auto-updated.

Last update: 2019-12-07 13:37:46 UTC


README

This library exposes the PHP implementation of four PlantUML encoding functions:

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

Usually only encodep() is used.

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads PHPPackages Rank PHPPackages Referenced By composer.lock Average time to resolve an issue Percentage of issues still open PDS Skeleton Issues

Purpose

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

Bob -> Alice : hello

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

Install

Install using Composer:

$ composer require jawira/plantuml-encoding

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}";

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

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

More examples:

Credits

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

Packages from jawira

jawira/plantuml (library)
Provides PlantUML integration: plantuml executable and plantuml.jar
jawira/emoji-catalog (library)
Get access to +3000 emojis as class constants.
jawira/case-converter (library)
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...