PHP code example of antoninmasek / laravel-hashids
1. Go to this page and download the library: Download antoninmasek/laravel-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/ */
antoninmasek / laravel-hashids example snippets
return [
/**
* If you wish to globally redefine the default alphabet you may do so below. If set to
* null, then the default value defined in the Hashids library is used.
*
* Please make sure your alphabet has at least 16 characters as that is the minimum
* length of the alphabet the Hashids package default salt you may do so below. If set to
* null, then the default value defined in the Hashids library is used.
*
* @see \Hashids\Hashids::__construct
*/
'salt' => null,
/**
* If you wish to globally redefine the default minimum length of the hash you may do so
* below. If set to null, then the default value defined in the Hashids library is used.
*
* Please note, that this is minimum length and not exact length. This means, that if
* you specify, for example, 5 the resulting hash id can have length of 5 characters
* or more.
*
* @see \Hashids\Hashids::__construct
*/
'min_length' => null,
];
use AntoninMasek\Hashids\Facades\Hashids;
Hashids::encode(1);
Hashids::decode('jR');
// With configuration
Hashids::alphabet('1234567890qwertz')->encode(1);
Hashids::salt('your-salt')
->minLength(10)
->encode(1)