PHP code example of tuupola / trytes
1. Go to this page and download the library: Download tuupola/trytes library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tuupola / trytes example snippets
use Tuupola\Trytes;
print Trytes::IOTA; /* 9ABCDEFGHIJKLMNOPQRSTUVWXYZ */
print Trytes::HEPTAVINTIMAL; /* 0123456789ABCDEFGHKMNPRTVXZ */
$default = new Trytes(["characters" => Trytes::IOTA]);
$heptavintimal = new Trytes(["characters" => Trytes::HEPTAVINTIMAL]);
print $default->encode("Hello world!"); /* RBTC9D9DCDEAKDCDFD9DSCFA */
print $heptavintimal->encode("Hello world!"); /* K2N304043451B4346404M361 */
php
$trytes = new Tuupola\Trytes;
$encoded = $trytes->encode(random_bytes(128));
$decoded = $trytes->decode($encoded);
php
use Tuupola\TrytesProxy as Trytes;
$encoded = Trytes::encode(random_bytes(128));
$decoded = Trytes::decode($encoded);