You can easily set the min_length of a hashid but it gets trickier setting the max_length as this would require setting a minimum length on the integer passed. Please avoid doing so in production environments as this could impact your system negatively. The sample code below indicates how to set min_length for PHP Laravel if using a different language kindly check for hashid implementation based on the language you are using.
namespace App\Hashing;use Hashids\Hashids; class Hash { private $salt_key; private $min_length; private $hashid; public function __construct(){ $this->salt_key = '5OtYLj/PtkLOpQewWdEj+jklT+oMjlJY7='; $this->min_length = 15; $this->hashid = new Hashids($this->salt_key, $this->min_length); } public function encodeId($id){ $hashed_id = $this->hashid->encode($id); return $hashed_id; } public function decodeId($hashed_id){ $id = $this->hashid->decode($hashed_id); return $id; } } $hash = new Hash(); $hashed_id = $hash->encodeId(1); echo '<pre>'; print_r($hashed_id); echo '</pre>'; echo "<pre>"; $id = $hash->decodeId($hashed_id); print_r($id[0]); echo "</pre>";