Skip to content

Instantly share code, notes, and snippets.

@Kydoh
Created November 8, 2013 14:51
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Kydoh/7372072 to your computer and use it in GitHub Desktop.
Save Kydoh/7372072 to your computer and use it in GitHub Desktop.
Generate random password (require FOSUserBundle)
<?php
$tokenGenerator = $this->getContainer()->get('fos_user.util.token_generator');
$password = substr($tokenGenerator->generateToken(), 0, 8); // 8 chars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment