我试图找到办法生成随机唯一的字符串长使用nelmio /爱丽丝8个字符。
而且我发现只有<uuid()>
(token (unique): <uuid()>
)方法,遗憾的是它返回过长的字符串,我只需要8个字符。
可能有些人知道优雅的解决方案?
谢谢,我已经找到解决方案
token (unique): '<( substr( md5( uniqid( rand(), true ) ) , 0, 8) )>'
nelmio/alice使用fzaninotto/Faker数据生成,您可以使用Faker\Provider\Lorem
或Faker\Provider\en_US\Text
:
<sentence($nbWords = 6, $variableNbWords = true)>
<text($maxNbChars = 200)>
<realText($maxNbChars = 200, $indexSize = 2)>