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

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners