Esempio n. 1
0
<?php

require_once '../vendor/autoload.php';
use Ballen\Plexity\Plexity as PasswordValidator;
$password = new PasswordValidator();
$password->requireSpecialCharacters()->requireUpperCase()->requireLowerCase()->requireNumericChataters(3);
// We want to ensure that the password uses atleast 3 numbers!
// An example of passing a password history array, if the password exists in
// here then we'll disallow it!
$password->notIn(['piggy', 'people', 'mypasSwordh88e8*&|re']);
try {
    $password->check('mypasSwordh88e8*&|re');
    echo "Great news! The password passed validation!";
} catch (Ballen\Plexity\Exceptions\ValidationException $exception) {
    die('The validation failed, the error was: ' . $exception->getMessage());
}
Esempio n. 2
0
 public function testPasswordNotInArray()
 {
     $password = new Plexity();
     $password->notIn(['Example2', 'An3xampl3', 'MyEx4mp!e']);
     $this->assertTrue($password->check('AC0mpl3telyD1fferentOne'));
 }