Laravel 8.x Released Strong Password Validation Rule

Hi artisan Laravel 8.x has released strong password validation feature.  Artisan in this laravel 8 password validation example i will show you how you can validate password and make a strong password validation using laravel default features.

You know that yesterday in Laravel 8.x an extra feature for password validation is added. Now you can validate password in your Laravel 8.x like belowNo need to use any package for creating strong password in laravel 8.x application.

If you want to use strong password then use and To ensure that passwords have an adequate level of complexity, you may use Laravel's Password rule object:

 

laravel-strong-password-example

 

See those example 

use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rules\Password;

$validator = Validator::make($request->all(), [
    'password' => ['required', 'confirmed', Password::min(8)],
]);

 

The Password rule object allows you to easily customize the password complexity requirements for your application, such as

// Require at least 8 characters...
Password::min(8)

// Require at least one letter...
Password::min(8)->letters()

// Require at least one uppercase and one lowercase letter...
Password::min(8)->mixedCase()

// Require at least one number...
Password::min(8)->numbers()

// Require at least one symbol...
Password::min(8)->symbols()

 

In addition, you may ensure that a password has not been compromised in a public password data breach leak using the uncompromised method:

Password::min(8)->uncompromised()

 

You can do also that ensure the password appears less than 3 times in the same data leak...

Password::min(8)->uncompromised(3);

 

Of course, you may also chain all the methods in the examples above:

Password::min(8)
    ->letters()
    ->mixedCase()
    ->numbers()
    ->symbols()
    ->uncompromised()

 

Read also : Regex Strong Password Validation Example in Laravel

 

Hope it can help you.

 

Facebook Github
A web enthusiastic, self-motivated Full-Stack Web Developer from Dhaka, Bangladesh with experience in developing applications using Laravel Vue and React Js Application.