symfony/password-hasher

Provides password hashing utilities

Maintainers

👁 fabpot

Package info

github.com/symfony/password-hasher

Homepage

pkg:composer/symfony/password-hasher

Statistics

Installs: 149 234 217

Dependents: 88

Suggesters: 2

Stars: 813

v8.1.0 2026-05-29 05:06 UTC

Requires

  • php: >=8.4.1

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 6934d16beaa4677f2c4584229fff1b51099dd7af

passwordhashing

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!

Resources