Search code examples
symfonyrandomfixturesnelmio-alicealice-fixtures

nelmio/alice random string with specified long


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?


Solution

  • Thanks I've found solution

    token (unique): '<( substr( md5( uniqid( rand(), true ) ) , 0, 8) )>'