babeuloula/password-constraint

Password constraint for Symfony

1.0.1 2024-03-04 09:41 UTC

This package is auto-updated.

Last update: 2024-11-09 13:23:15 UTC


README

Password constraint for Symfony. Based on the validator of Laravel framework. It's recommended to use with NotCompromisedPassword constraint.

Requirements

  • php >= 8.1
  • symfony/validator >= 6.0

Installation

composer require babeuloula/password-constraint

How to use?

use BaBeuloula\Constraint\Password;

class PasswordDummy
{
    #[Password]
    private $a;

    #[Password(min: 8, minMessage: 'myMessage')]
    private $b;

    #[Password(letters: true, lettersMessage: 'myMessage', groups: ['my_group'])]
    private $c;
  • min (12): The minimum size of the password.
  • mixedCase (false): If the password requires at least one uppercase and one lowercase letter.
  • letters (false): If the password requires at least one letter.
  • numbers (false): If the password requires at least one number.
  • symbols (false): If the password requires at least one symbol.