PHP code example of decodelabs / guidance

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

    

decodelabs / guidance example snippets


use DecodeLabs\Guidance;
use DecodeLabs\Guidance\Format;

// Generate a v4 UUID
$v4 = Guidance::createV4();
$version = $v4->getVersion(); // Version::V4

$string1 = (string)$v4; // Full UUID string
$string2 = $v4->shorten(); // Base 62 (default) encoded UUID
$string3 = $v4->shorten(Format::FlickrBase58); // Base 58 encoded UUID

$new1 = Guidance::from($string1); // Parse full UUID string
$new2 = Guidance::fromShortString($string3, Format::FlickrBase58);