PHP code example of gerlovsky / php-short-id

1. Go to this page and download the library: Download gerlovsky/php-short-id 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/ */

    

gerlovsky / php-short-id example snippets




$shortId = new \Gerlovsky\ShortId\ShortId();

$id = $shortId->encode(20956);     // $id will be 'bfrE'

// or with $length = 6
$id = $shortId->encode(20956, 6);  // $id will be 'baauC6'