PHP code example of torann / hashids

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

    

torann / hashids example snippets


'providers' => [
    Torann\Hashids\HashidsServiceProvider::class,
]

'aliases' => [
    'Hashids' => Torann\Hashids\Facade\Hashids::class,
]

Hashids::encode(1); // Returns Ri7Bi

Hashids::encode(1, 21, 12, 12, 666); // Returns MMtaUpSGhdA

Hashids::decode(Ri7Bi);

// Returns
array (size=1)
0 => int 1

Hashids::decode(MMtaUpSGhdA);

// Returns
array (size=5)
0 => int 1
1 => int 21
2 => int 12
3 => int 12
4 => int 666

$ php artisan vendor:publish --provider="Torann\Hashids\HashidsServiceProvider"