taylornetwork/laravel-username-generator

How to force the length of user name

CyberMullah opened this issue · 2 comments

I have tried the package as below:

 UsernameGenerator::generate($request->name . ' ' . $request->lastname)

.. and I passed the name 12s with something as the lastname but I got just s as the username.

I want to force the length of the user that it should generate about 5 chars. How should I do this?

The package currently doesn't have a way to make a minimum length username, I can add that as an option though.

For the 12s generating a username of s if you want to include numbers from the name just change the allowed_characters option in the config to

'allowed_characters' => 'a-zA-Z0-9 ',

Added support in v2.2

See Setting a Minimum Length