Str::random() example

PHP
use Illuminate\Support\Str;

$random = Str::random(40);
Source

Also in PHP: