PHP code example of byjg / shortid
1. Go to this page and download the library: Download byjg/shortid 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/ */
byjg / shortid example snippets
$shortid = \ByJG\ShortId\ShortId::fromNumber(81717788171667188198);
// Will write: Qi0yuM2uKwJb
use ByJG\ShortId\ShortId;
// Create short ID from number
$shortid = ShortId::fromNumber(1234567890);
// Get the number back
$number = ShortId::get($shortid);
// Create from UUID
$shortid = ShortId::fromUuid('092395A6-BC87-11ED-8CA9-0242AC120002');
// Create from hex
$shortid = ShortId::fromHex('3e');
// Generate random short ID
$shortid = ShortId::fromRandom();