YsUtil
composer require exiang/ys-utilEmail Related
sendMail($receivers, $subject, $message, $params, $sendOnBehalf='')
logSentMail($mailObj, $mailLogPath)
String Manipulation
html2text($html)
splitFullName2FirstLast($name)
generateUUID()
slugify($text)
generateRandomKey($max=5, $min=4, $mode='alphanumeric')
generateRandomPassword($max='8', $min='8', $lowerCase=true)
nl2space($string)
truncate($string='', $limit=100, $pad='...')
mbWordWrap($string, $width=75, $break="\n", $cut=false)
widerKeyword($keyword)
null2empty($string)
strPutCsv($input, $delimiter = ',', $enclosure = '"')
Array Manipulation
yskrsort($array)
string2Array($str, $separator=',')
generateArrayRange($start, $stop, $mode='1d')
convertToKeyValueArray($array, $code='key', $title='title')
convert1dTo2dArray($array)
Data Format Related
decimal2Bui($decimal)
bui2Decimal($bui)
m2km($meter, $showUnit=false)
formatByte($bytes, $unit = "MB", $decimals = 2)
ssNum2Alpha($n)
isMd5($string)
isSha1($string)
isAlphaNumeric($input)
isEmailAddress($input)
isJson($string)
File System Related
getMimeType($filename)
listDir($dir, $recur = true)
fileGetBinary($file)
getFileName($filename)
getFileExtension($filename)
Date Time Related
timezone2offset($name)
convertTimezone($timestamp, $toTimezone, $fromTimezone='GMT')
timeElapsed($timestamp, $precision=5)
getWeekInMonth($timestamp, $rollover='sunday')
calculateAge($timestamp = 0, $now = 0)
monthNumber2Name($number, $format='F')
dateDiff($interval, $datefrom, $dateto, $using_timestamps = false)
Network & Cloudflare Related
ipInRange($ip, $range)
getRequestIP()
isCloudflare()
cloudflareCheckIP($ip)
cloudflareRequestsCheck()
Others
toChinaseNum($num)
Last updated