Laravel Zxcvbn

Laravel Zxcvbn stats

Downloads
45.6K
Stars
6
Open Issues
0
Forks
1

View on GitHub →

Zxcvbn Password validation rule for Laravel

Zxcvbn Password validation rule for Laravel

Laravel Zxcvbn Password Validation Rule. Nothing more, nothing less.

For an introduction to Dropbox Zxcvbn, see the following link

https://dropbox.tech/security/zxcvbn-realistic-password-strength-estimation

Installation

You can install the package via composer:

composer require ziming/laravel-zxcvbn

You can publish the config file with:

php artisan vendor:publish --tag="zxcvbn-config"

This is the contents of the published config file. The default min score is set to 3.

<?php
 
return [
// If you wish to override the default min score in the config,
// you can do so by passing in a second argument to the ZxcvbnRule constructor.
// e.g. new ZxcvbnRule([], 4)
'min_score' => env('ZXCVBN_MIN_SCORE', 3),
];

bjeavons/zxcvbn-php provides a good overview on the zxcvbn score.

Scores are integers from 0 to 4:
 
- 0 means the password is extremely guessable (within 10^3 guesses), dictionary words like 'password' or 'mother' score a 0
- 1 is still very guessable (guesses < 10^6), an extra character on a dictionary word can score a 1
- 2 is somewhat guessable (guesses < 10^8), provides some protection from unthrottled online attacks
- 3 is safely unguessable (guesses < 10^10), offers moderate protection from offline slow-hash scenario
- 4 is very unguessable (guesses >= 10^10) and provides strong protection from offline slow-hash scenario

Usage

// In your validation rules
use Illuminate\Validation\Rules\Password;
use Ziming\LaravelZxcvbn\Rules\ZxcvbnRule;
 
[
'name' => ['required']
'email' => ['required', 'email'],
'password' => [
'required',
'confirmed',
'min:8',
new ZxcvbnRule([
request('email'),
request('name'),
]),
],
]
 
## Testing
 
```bash
composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Ziming Laravel Zxcvbn Related Articles

Laravel Time Machine: A Request Lifecycle Profiler image

Laravel Time Machine: A Request Lifecycle Profiler

Read article
USAIGE: Track Token Usage and Costs for Laravel AI SDK Requests image

USAIGE: Track Token Usage and Costs for Laravel AI SDK Requests

Read article
Laravel Brain: Visualize Your Application's Request Lifecycle image

Laravel Brain: Visualize Your Application's Request Lifecycle

Read article
RedBerry to Host Georgia's First Laravel Meetup in Tbilisi image

RedBerry to Host Georgia's First Laravel Meetup in Tbilisi

Read article
Flaky Test Retries in Pest v4.5.0 image

Flaky Test Retries in Pest v4.5.0

Read article
UnitTest Attribute and More in Laravel 13.3.0 image

UnitTest Attribute and More in Laravel 13.3.0

Read article
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech