PHP code example of diarmuidie / niceid

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

    

diarmuidie / niceid example snippets




use Diarmuidie\NiceID\NiceID;

$niceid = new NiceID('Some Random Secret Value');
echo $niceid->encode(123); // uSdqd

echo $niceid->decode('uSdqd'); // 123

$niceid->setMinLength(10);
echo $niceid->encode(123); // uccccccu8p

$niceid->setCharacters('abcde');
echo $niceid->encode(123); // adcce

$niceid->setCharacters('ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ');
echo $niceid->encode(123); // ⓖⓑⓥⓘⓘⓠ