symfony / password-hasher
Provides password hashing utilities
v8.1.0
2026-05-29 05:06 UTC
Requires
- php: >=8.4.1
Requires (Dev)
- symfony/console: ^7.4|^8.0
- symfony/security-core: ^7.4|^8.0
This package is auto-updated.
Last update: 2026-06-05 06:50:39 UTC
README
The PasswordHasher component provides secure password hashing utilities.
Getting Started
composer require symfony/password-hasher
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory; // Configure different password hashers via the factory $factory = new PasswordHasherFactory([ 'common' => ['algorithm' => 'bcrypt'], 'memory-hard' => ['algorithm' => 'sodium'], ]); // Retrieve the right password hasher by its name $passwordHasher = $factory->getPasswordHasher('common'); // Hash a plain password $hash = $passwordHasher->hash('plain'); // returns a bcrypt hash // Verify that a given plain password matches the hash $passwordHasher->verify($hash, 'wrong'); // returns false $passwordHasher->verify($hash, 'plain'); // returns true (valid)
Sponsor
This package is looking for a backer.
Help Symfony by sponsoring its development!