symfony/password-hasher
Symfony's PasswordHasher component provides secure password hashing utilities, with a factory to configure multiple algorithms like bcrypt and sodium. Hash plain passwords and verify them easily in your PHP applications.
Architecture Fit
symfony/password-hasher is a Symfony component, not a Laravel package. Laravel does not consume it. Illuminate\Hashing wraps PHP's native password_hash() / password_verify() and ships its own BcryptHasher, ArgonHasher, and Argon2IdHasher drivers behind the Hash facade. Any claim that this is a drop-in Laravel upgrade is wrong and should be corrected in the intake ticket.Illuminate\Contracts\Hashing\Hasher on top of Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory, bind it in a service provider, and select it per-tenant or per-role. It changes the hashing policy layer, not the framework's auth stack.PasswordHasherInterface contract (hash / verify / needsRehash) plus MigratingPasswordHasher and LegacyPasswordHasher. needsRehash() is the actual product value — it turns "transparently rotate every password hash on next login" from a bespoke subsystem into a one-line check inside an auth listener.$2a$ variants) that must remain verifiable during a migration window, or a polyglot platform where one hashing-policy abstraction is worth more than per-framework drivers.Integration Feasibility
Illuminate\Auth\Events\Login listener → needsRehash() → re-hash → persist → handle the fact that the session was already established),Technical Risk
symfony/symfony, maintained by the Symfony core team, MIT licensed, and exercised by effectively the entire Symfony install base. The code quality risk is low; the integration risk is what we own.symfony/security-bundle and the monolithic symfony/symfony repo, not here. Do not let a supply-chain scanner read "0 dependents" as abandonment, and do not read 807 stars as independent popularity. Judge it on the parent project's maintenance record.ext-sodium (or libsodium Argon2 support) present in dev, CI, staging, and every production container. A missing extension surfaces as a container-instantiation error — and the dangerous failure mode is someone "fixing" it by falling back to a weaker hasher in one environment, producing silent policy drift.MigratingPasswordHasher — the migration semantics are where teams get surprised.Key Questions
config/hashing.php.needsRehash() login hook, and what happens if the rehash write fails after the session is established? (Answer must be: login succeeds, rehash is retried next time, never a lockout.)Stack Fit
symfony/security-bundle and should not install it directly — duplicating a transitive dependency is how version conflicts start.PasswordHasherManager service exposing hash(), verify(), needsRehash(), resolving a named hasher from a policy map (e.g. tenant_tier → hasher_name). One class, one binding, one config block — that is the entire surface a reviewer needs to read.Migration Path
Hash. Feature-flagged, dark-launched on one non-critical tenant or the internal admin console.Login listener. Every successful login upgrades its own row. Emit a counter metric per (old algorithm → new algorithm) transition. This is the phase that needs the security review and the rollback plan.LegacyPasswordHasher wiring and the old dependency pin. File the removal ticket in Phase 1, not Phase 4.ext-sodium is confirmed present in every target environment's image, verified by a CI health check rather than a verbal assurance.Compatibility
composer.json; do not float on ^8.0 if any service runs PHP < 8.4.Hash driver contract — Hash::check() argument order is (plain, hashed), while Symfony's verify() is ($hash, $plain). This inversion is the single most likely source of a subtle, test-passing, production-breaking bug. Write the adapter test first.Maintenance
Support
symfony/password-hasher will get redirected). No commercial SLA. No vendor to call.ext-sodium. If the runbook grows past that, the integration is too clever.Scaling
Failure Modes
ext-sodium absent in one environment → container-instantiation fatal. Loud and safe. The dangerous variant is a fallback to a weaker hasher, which is silent and is a policy violation. Forbid fallbacks in code review.Ramp-Up
MigratingPasswordHasher and PasswordHasherInterface source, one day writing the adapter and its tests.config/hashing.php tune-up instead. A "no" here is a successful outcome, not a failed evaluation.How can I help you explore Laravel packages today?