By John Koster
The randomBytes helper method is used to generate a string of bytes of the given $length. The results of the randomBytes are more random than the results of the random method. randomBytes requires the OpenSSL extension extension for PHP version 5 as it will internally use the openssl_random_pseudo_bytes function. For PHP version 7, the random_bytes function will be utilized. And as of Laravel version 5.2, the randomBytes helper method has been deprecated in favor of PHP's random_bytes function.
The signature for the randomBytes helper method is:
randomBytes($length = 16)
This method will throw an instance of RuntimeException if OpenSSL is not installed and configured or if it was unable to generate a random string.
∎