Simple Random Password in Symfony 2
From withing a Controller, do the following to get a random 12 digit alphanumeric password:
$tokenGenerator = $this->container->get('fos_user.util.token_generator');
$password = substr($tokenGenerator->generateToken(), 0, 12);
Written by Jrgns
Related protips
1 Response
You should mention that if someone uses this he needs FOSUserBundle too.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Random
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#