Source: vumanhtrung.medium.com

A new Password Rule object from Laravel 8.39

Category: Laravel, api

In previous versions, to define a custom validation rule, you must to implement the Illuminate\Contracts\Validation\Rule interface or use a Closure. As below code, a custom rule StrongPassword like so. And use it in your controller or request validation. From version 8.39, Nuno Maduro created a new Password Rule object in this framework with below methods: min(): Makes minimum size of the password.mix edCase(): Makes the password require at least one uppercase and one lowercase letter.letters(): Makes the password require at least one letter.numbers(): Makes the password require at least one number.symbols(): Makes the password require at least one symbol.uncompromised(): Ensures the password has not been compromised by checking the password against a verification API to see if the password appears in data leaks. Or you can use them all combined like so.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners