aurion72 / helpers
Aurion72 助手
v1.1.2
2022-03-04 09:33 UTC
Requires
- php: >=7.2
- illuminate/support: >=5.6
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
README
Helpers 是一个通用包,包含一些有用的辅助函数。
用法
debug
rawSql($builder)
: 从查询构建器返回原始 SQL
loadingTimeStart()
: 开始计算加载时间
loadingTimeEnd($die = true)
: 保存加载时间
strings
boolToString($value, $true_string = null, $false_string = null, $locale = null)
: 将值转换为字符串。
boolToColorizedString($value, $true_string = null, $false_string = null, $locale = null)
: 将值转换为带颜色的字符串(BS4 风格)
formatPrice($price, $currency_sign = ' €')
: 将数字转换为货币格式的字符串
formatPercent($percent, $precision = 2, $percent_sign = true)
: 将数字转换为百分比格式的字符串
randomPassword($length, $caps = false)
: 生成随机密码
media
rmdirRecursive($dir)
: 递归删除目录和文件
stringToHexColor($string)
: 将字符串转换为十六进制颜色
numbers
randomBoolean($chance_of_true = 50)
: 返回具有随机因素的布尔值
addSign($value, $minus_only = false)
: 为数字添加符号