symfony/password-hasher
Symfony PasswordHasher provides secure password hashing and verification utilities. Configure multiple algorithms via PasswordHasherFactory (bcrypt, sodium/Argon2, etc.), hash plain passwords, verify hashes, and support upgrades with modern best practices.
PasswordHasherFactory, reducing attack surface without disrupting workflows. Aligns with zero-trust principles by applying stronger hashing to high-risk accounts.auto algorithm automatically upgrades hashes during login, eliminating manual database migrations when switching algorithms (e.g., from bcrypt to Argon2). Reduces downtime and user friction during security upgrades.Hash facade (e.g., for compliance or high-security use cases).Hash facade (bcrypt) suffices for your security needs (no advanced algorithms or compliance requirements).VARCHAR(255) or larger for output)."This package eliminates a critical security gap by replacing ad-hoc password hashing with a standardized, audited solution compliant with NIST, OWASP, and GDPR. By adopting Argon2 for high-risk accounts (e.g., admins, APIs) and auto-migrating legacy hashes, we reduce breach liability from brute-force attacks—without disrupting users. The cost? A one-time engineering effort to integrate it with Laravel. The alternative? Risking a data breach from weak hashing and the PR nightmare that follows. This is a low-risk, high-reward security upgrade that aligns with our compliance roadmap and reduces long-term technical debt."
*"For Laravel, we’d create a lightweight adapter to wrap Symfony’s
PasswordHasherFactory, giving us:
- Argon2 support (for compliance or admin accounts),
- Multi-algorithm hashing (e.g., bcrypt for users, Sodium for APIs),
- Automatic hash upgrades (no manual migrations),
- Fine-grained control over hashing parameters (e.g., Argon2 memory cost).
The tradeoff? A one-time integration effort (~2–3 dev days) to bridge Symfony’s factory pattern with Laravel’s facade. If we stick with Laravel’s default, we’re limited to bcrypt and lack control over hashing—potentially violating compliance requirements. For projects needing advanced security, this is worth the cost. Alternatives? Rolling our own hashing (risky) or using a less maintained package (higher long-term cost)."*
*"This package addresses three key risks:
- Weak algorithms: Replaces SHA-1/MD5 with Argon2id or bcrypt (NIST-compliant).
- Custom implementations: Eliminates homegrown hashing (OWASP A03:2021).
- Migration pain: The
autoalgorithm handles upgrades during login, reducing downtime.It integrates with Laravel’s existing auth system and supports tiered security (e.g., stronger hashing for admins). The only caveat is ensuring your database can store Argon2 hashes (255+ chars). For any project handling sensitive data, this is a must-have to meet GDPR, PCI DSS, or HIPAA requirements."*
*"This decision impacts:
- User trust: Stronger hashing reduces breach risks, improving brand reputation.
- Compliance costs: Avoids fines from GDPR (€20M or 4% revenue) or PCI DSS violations.
- Feature velocity: Enables tiered security for premium features (e.g., admin dashboards) without rewriting auth.
- Tech debt: Eliminates future refactoring costs from legacy hashing vulnerabilities.
Tradeoffs:
- Short-term: 2–3 dev days to integrate the adapter.
- Long-term: Zero security incidents from weak hashing, faster compliance audits, and scalable security controls.
Recommendation: Prioritize this for high-risk products (e.g., fintech, healthcare) or if compliance deadlines are approaching."*
How can I help you explore Laravel packages today?