Skip to content

Instantly share code, notes, and snippets.

@chalasr
Forked from Kydoh/new_gist_file
Last active January 20, 2016 10:16
Show Gist options
  • Select an option

  • Save chalasr/f522d737ccc254ea2b7d to your computer and use it in GitHub Desktop.

Select an option

Save chalasr/f522d737ccc254ea2b7d 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