$random_name = str_random(8); laravel code example Example: laravel Str::random use Illuminate\Support\Str; $random = Str::random(40);