PHP code example of gogh-idawoodjee / shortcode

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

    

gogh-idawoodjee / shortcode example snippets


use GoghIdawoodjee\ShortCode\ShortCode;

ShortCode::encode(123456);    // "W7E"
ShortCode::decode('W7E');     // 123456

$uuid = '550e8400-e29b-41d4-a716-446655440000';

$short = ShortCode::encodeUuid($uuid);  // "5mSYFjfBLkNseKP0tQ8y0w"
$back  = ShortCode::decodeUuid($short); // "550e8400-e29b-41d4-a716-446655440000"

use GoghIdawoodjee\ShortCode\Facades\ShortCode;

ShortCode::encodeUuid($uuid);
ShortCode::decodeUuid($code);

ShortCode::encode(-1);           // negative number
ShortCode::decode('abc!');       // invalid character
ShortCode::encodeUuid('nope');   // not a valid UUID