str::random($length = false, $type = 'alphaNum')

Generates a random string that may be used for cryptographic purposes

  • $length (int)
    The length of the random string
  • $type (string)
    Pool type (type of allowed characters)
  • return (string)

2.4.0 +

This method now produces more random strings that may be used for cryptographic purposes.

WARNING: The new more random behavior requires PHP 7.0 or later, otherwise Kirby will fall back to str::quickRandom($length = false, $type = 'alphaNum').