bjeavons/zxcvbn-php
PHP port of Dropbox’s zxcvbn password strength estimator. Uses pattern matching and conservative entropy to score passwords 0–4, detect common words/names/patterns (dates, repeats, sequences, keyboard runs), and return user-friendly warnings/suggestions.
Strengths:
score, feedback.suggestions) remains intact for UI/UX enhancements.Fit Gaps:
password_hash()).POST /users or PATCH /users/{id} validation.factorial type declaration change in 1.4.2 is internal-only and does not affect auth systems or public APIs. No risk to existing integrations.score >= 3) or use it for advisory feedback?feedback.suggestions) be surfaced to users (e.g., tooltip, inline hints)?factorial type declaration fix in 1.4.2 is non-breaking and does not require action. Monitor for future internal changes that might impact edge cases.Zxcvbn to Illuminate\Contracts\Auth\PasswordValidator).Symfony\Component\Validator\Constraint.validatePasswordStrength).Zxcvbn::guessStrength().use Bjeavons\Zxcvbn\Zxcvbn;
$zxcvbn = new Zxcvbn();
$result = $zxcvbn->guessStrength($plainPassword);
if ($result['score'] < 3) {
throw new \InvalidArgumentException('Password too weak');
}
feedback.suggestions for UI hints (e.g., "Add a number").app/Http/Middleware/EnforcePasswordStrength.php).password_hash; no framework-specific code).Zxcvbn to test edge cases (e.g., empty strings, very long passwords).factorial type fix only).dd($result) to inspect feedback for edge cases.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Library regression (e.g., score calculation) | False rejections/acceptances | Pin to specific version; test against known inputs. |
| PHP version incompatibility | Breaks auth flows | Use php:^8.0 in composer.json. |
| Custom policy misconfiguration | Overly strict/lenient rules | Unit test with boundary cases (e.g., score=0 inputs). |
Dependency on password_hash |
Fails on legacy PHP systems | Polyfill or enforce PHP 8.0+ in CI. |
Updated: Internal type changes (e.g., factorial) |
No impact on auth systems | Monitor changelog for future internal changes. |
password123 → score 0).Tr0ub4dour&3 → score 4).привет123).How can I help you explore Laravel packages today?