symfony/password-hasher
Symfony PasswordHasher provides secure password hashing and verification with modern algorithms like bcrypt and sodium. Use PasswordHasherFactory to configure multiple hashers and select the right one for your app’s needs.
stdin support in security:hash-password (via Symfony’s password-hasher v8.1.0-BETA3) improves developer experience for manual password hashing, aligning with Laravel’s CLI-first workflows (e.g., php artisan tinker). This is non-breaking but reduces friction for ad-hoc testing/debugging.security:hash-password (e.g., deprecated algorithms) strengthens auditability during migrations. This complements the package’s existing NIST/OWASP compliance by surfacing risks earlier in the pipeline.Hash facade replacement logic.PasswordHasherFactory.hash()/verify() methods in application code.stdin feature hints at broader Symfony/Laravel CLI integration (e.g., php artisan password:hash), which could streamline password rotation or audit workflows in future releases.security:hash-password for manual testing (e.g., php vendor/bin/security:hash-password in Laravel projects) without modifying the package’s service bindings.stdin input in CI/CD pipelines if using the CLI tool for automated hashing (e.g., during deployments).stdin improvements.security:hash-password as a supported tool for Laravel teams (e.g., in README.md)?password_hash() calls in the codebase and replace them with the package’s hash() method during migration?stdin input add latency to bulk hashing operations (e.g., rehashing 10K users)?stdin improvement is fully compatible with Laravel’s existing integration of Symfony’s password-hasher. No changes to the PasswordHasherFactory or Laravel service bindings are required.php vendor/bin/security:hash-password stdin
# Paste password > Enter > Outputs hash
Useful for debugging or one-off migrations.echo "password" | php vendor/bin/security:hash-password).| Phase | Action Items | Risk | Mitigation |
|---|---|---|---|
| Assessment | Audit for direct password_hash() calls (replace with Hash::make()). |
Inconsistent hashing. | Use phpcs to detect violations; enforce via PSR-12. |
| CLI Adoption | Document security:hash-password in internal runbooks for manual hashing (e.g., service accounts). |
Undocumented workflows. | Add examples to README.md (e.g., "Hashing API keys"). |
| Warning Handling | Configure CLI to log warnings (e.g., deprecated algorithms) to a file or SIEM (e.g., security:hash-password --log-warnings). |
Missed security issues. | Route warnings to Sentry or Datadog for alerts. |
| Testing | Add tests for: | CLI misconfiguration. | Mock stdin input in PHPUnit (e.g., fwrite(STDIN, ...)). |
- stdin input/output in CI. |
|||
| - Algorithm warnings during migration. | |||
| - Performance of bulk hashing via CLI. | |||
| Deployment | Phase 1: Use CLI for non-critical hashing (e.g., test users). | Limited impact. | Monitor auth.log for failures. |
Phase 2: Integrate CLI into CI/CD for automated password rotation (e.g., for APP_KEY). |
CI/CD failures. | Use feature flags to toggle CLI usage. | |
| Monitoring | Track: | Post-migration issues. | |
- CLI usage (e.g., security:hash-password invocations). |
|||
| - Warning frequency (e.g., SHA-1 detections). | |||
| - Hashing performance (compare CLI vs. programmatic). |
ext/sodium: Still required for Argon2id/Sodium (no change).ext/password: Required for bcrypt (no change).--non-interactive flag or pipe input.password_hash() or direct Symfony CLI tools.security:hash-password in a staging environment with identical PHP extensions.README.md (e.g., hashing API keys).APP_KEY).password_hash() calls with Hash::make().stdin feature **simplifiesHow can I help you explore Laravel packages today?