You can use PHP openssl_random_pseudo_bytes() or random_bytes() methods to generate random bytes of a fixed number and then convert them to readable format using the bin2hex() method.
<?php
$token = bin2hex(openssl_random_pseudo_bytes(20));
echo "$token";
// If you are using PHP 7 - You can also use
$token = bin2hex(random_bytes(20));
echo $token;
?>
0 Comments