<?php namespace App\Helpers; class MiscHelper { public static function gravatarUrl($emailAddress, $size = 48, $default = 'identicon') { $hash = md5(strtolower(trim($emailAddress))); return sprintf('https://www.gravatar.com/avatar/%s?s=%d&d=%s', $hash, $size, $default); } public static function randomString($length = 10) { $seed = 'abcdefghijklmnopqrstuvwxyz01234567890'; $string = ''; while (strlen($string) < $length) { $string .= substr($seed, rand(0, strlen($seed) - 1), 1); } return $string; } }