- Add
tuupola/base85
library to composer.json
file:
"require": {
"tuupola/base85": "^2.0"
}
- Install library from the command line:
composer install
- Encode and decode data using Ascii85 (Base85):
<?php
use Tuupola\Base85;
require_once __DIR__.'/vendor/autoload.php';
$ascii85 = new Base85([
'characters' => Base85::ASCII85,
'compress.spaces' => false,
'compress.zeroes' => true,
]);
$text = 'Hello';
$ascii85Str = $ascii85->encode($text);
echo $ascii85Str.PHP_EOL;
$text = $ascii85->decode($ascii85Str);
echo $text.PHP_EOL;
Leave a Comment
Cancel reply