symfony / password-hasher
Provides password hashing utilities
Fund package maintenance!
fabpot
Tidelift
symfony.com/sponsor
Requires
- php: >=8.2
Requires (Dev)
- symfony/console: ^6.4|^7.0
- symfony/security-core: ^6.4|^7.0
Conflicts
- symfony/security-core: <6.4
- 7.2.x-dev
- 7.1.x-dev
- v7.1.1
- v7.1.0
- v7.1.0-RC1
- v7.1.0-BETA1
- 7.0.x-dev
- v7.0.8
- v7.0.7
- v7.0.4
- v7.0.3
- v7.0.0
- v7.0.0-RC1
- v7.0.0-BETA3
- v7.0.0-BETA1
- 6.4.x-dev
- v6.4.8
- v6.4.7
- v6.4.4
- v6.4.3
- v6.4.0
- v6.4.0-RC1
- v6.4.0-BETA3
- v6.4.0-BETA1
- 6.3.x-dev
- v6.3.12
- v6.3.8
- v6.3.5
- v6.3.0
- v6.3.0-RC1
- v6.3.0-BETA1
- 6.2.x-dev
- v6.2.7
- v6.2.5
- v6.2.0
- v6.2.0-RC1
- v6.2.0-BETA1
- 6.1.x-dev
- v6.1.11
- v6.1.3
- v6.1.0
- v6.1.0-RC1
- v6.1.0-BETA2
- v6.1.0-BETA1
- 6.0.x-dev
- v6.0.19
- v6.0.11
- v6.0.8
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v6.0.0-RC1
- v6.0.0-BETA1
- 5.4.x-dev
- v5.4.40
- v5.4.39
- v5.4.36
- v5.4.35
- v5.4.31
- v5.4.29
- v5.4.27
- v5.4.21
- v5.4.19
- v5.4.11
- v5.4.8
- v5.4.3
- v5.4.2
- v5.4.0
- v5.4.0-RC1
- v5.4.0-BETA1
- 5.3.x-dev
- v5.3.14
- v5.3.8
- v5.3.7
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.0
- v5.3.0-RC1
- v5.3.0-BETA3
- v5.3.0-BETA2
- v5.3.0-BETA1
This package is auto-updated.
Last update: 2024-09-25 14:31:27 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)