Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tixastronauta/80dfc3e8a534c76136711628ef726c68 to your computer and use it in GitHub Desktop.
Save tixastronauta/80dfc3e8a534c76136711628ef726c68 to your computer and use it in GitHub Desktop.

Snippet to generate an encoded password for Silex/Symfony usage

$username = "admin";
$password = "pass1234";

$factory = $app['security.encoder_factory'];
$user = new \Symfony\Component\Security\Core\User\User($username, $password);
$encoder = $factory->getEncoder($user);
$encodedPassword = $encoder->encodePassword($password, $user->getSalt());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment