PHP code example of takaram / uuid47

1. Go to this page and download the library: Download takaram/uuid47 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/ */

    

takaram / uuid47 example snippets



declare(strict_types=1);

use Ramsey\Uuid\Uuid;
use Takaram\Uuid47\Uuid47;

0123456789abcdeffedcba9876543210');

// Example v7 string (any valid v7 will do):
$uuid = Uuid::fromString('018f2d9f-9a2a-7def-8c3f-7b1a2c4d5e6f');
$facade = Uuid47::encode($uuid, $key);
$back = Uuid47::decode($facade, $key);

echo "v7 in : $uuid\n";
echo "v4 out: $facade\n";
echo "back  : $back\n";


declare(strict_types=1);

use Ramsey\Uuid\Uuid;
use Takaram\Uuid47\Codec;

$uuid = Uuid::fromString('018f2d9f-9a2a-7def-8c3f-7b1a2c4d5e6f');
$facade = $codec->encode($uuid, $key);
$back = $codec->decode($facade, $key);

echo "v7 in : $uuid\n";
echo "v4 out: $facade\n";
echo "back  : $back\n";