1

I was trying to find way generate random unique string with 8 characters long using nelmio/alice.

And I've found only <uuid()> (token (unique): <uuid()>)method, unfortunately it returns too long string, I need just 8 characters.

May be some one knows elegant solution?

Mykyta Popov
  • 57
  • 1
  • 8

2 Answers2

2

Thanks I've found solution

token (unique): '<( substr( md5( uniqid( rand(), true ) ) , 0, 8) )>'
Mykyta Popov
  • 57
  • 1
  • 8
1

nelmio/alice uses fzaninotto/Faker for data generation, you can use Faker\Provider\Lorem or Faker\Provider\en_US\Text:

<sentence($nbWords = 6, $variableNbWords = true)>
<text($maxNbChars = 200)>
<realText($maxNbChars = 200, $indexSize = 2)>
itnelo
  • 1,053
  • 2
  • 18
  • 29