hj4n3w
Last Updated: February 25, 2016
·
6.474K
· jrgns
B57be2c7d4dc1fe290e0fc9589c53e54

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);
Say Thanks
Respond

1 Response
Add your response

6127
2013 02 14 vhs

You should mention that if someone uses this he needs FOSUserBundle too.

over 1 year ago ·