PHP code example of andrey-helldar / strong-password

1. Go to this page and download the library: Download andrey-helldar/strong-password library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

andrey-helldar / strong-password example snippets


public function register()
{
    $this->app->register(\Helldar\StrongPassword\ServiceProvider::class);
}

// 1
$validator = \Validator::make(['foo' => 'qwerty'], ['foo' => 'psw_letters']);
$validator->passes(); // return `true`

// 2
$validator = \Validator::make(['bar' => 'qwerty'], ['bar' => 'psw_case_diff']);
$validator->passes(); // return `false`

// 3
$validator = \Validator::make(['baz' => 'qweRTY123!#'], ['baz' => 'psw_strong']);
$validator->passes(); // return `true`

// 4
$validator = \Validator::make(['baz' => 'qweRTY123!#'], ['baz' => 'psw_letters|psw_min_length']);
$validator->passes(); // return `true`

use Helldar\StrongPassword\Facades\Password;

return Password::validate('qwerty');

return Password::errors('qwerty');

return Password::isAllow('qwerty');

return [
    'min_length' => 27,

    'rules' => [
        'psw_letters',
        'psw_numbers',
        'psw_min_length',
    ],
];

$password = 'qwerty';

return Password::validate($password);
// throw ValidationException

return Password::errors($password);
// return array:
// [
//     'password' => [
//         'The password must 

$password = 'qWeRtYuIoP[]#!123qWeRtYuIqwd';

return Password::validate($password);
// [
//     'password' => 'qWeRtYuIoP[]#!123qWeRtYuIqwd'
// ]

return Password::errors($password);
// return null

return Password::isAllow($password);
// return true

php artisan vendor:publish --provider="Helldar\StrongPassword\ServiceProvider"