jord-jd/laravel-password-exposed-validation-rule
A Laravel validation rule that checks passwords against the Have I Been Pwned database, helping you reject known-breached credentials during registration or password changes. Simple to add to form requests and validators.
composer require and let Laravel's package discovery register the service provider; publish the config only if you need to change timeout, cache, or fail-open behaviour.passes() implementation) and the config file — the rule's behaviour on non-string input changed in v6.1.0 and is the single most important thing to understand before wiring it in.FormRequest, alongside Laravel's own string and length rules:'password' => ['required', 'string', 'min:12', 'confirmed', new NotBreached()],
string/type rules. Compose accordingly from day one.string (and Password::defaults() if you use it). The package explicitly documents this composition because the rule now tolerates non-string input rather than flagging it.Password::defaults()-style factory method returning a consistent rule stack.__toString() is stringified and checked, so a Password DTO or a Stringable cast flows through unchanged — useful if you normalise input before validation.Http::fake() (or the package's binding, if it exposes one) so your suite is hermetic. Assert both the passing and failing branch — that's what the new regression coverage in this release does upstream.string or bail explicitly, or a malformed payload will satisfy this rule.string rule to catch the same input earlier and more clearly.__toString() can throw. An object that is Stringable but throws during stringification will surface as an exception, not a validation failure. Guard or cast upstream if you accept arbitrary objects.nullable/required; don't duplicate that logic in the rule stack.How can I help you explore Laravel packages today?