schwarzer / laravel-rules
Laravel Rules
1.2.0
2021-03-02 12:12 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^7.0|^8.0
Requires (Dev)
- orchestra/testbench: ^6.2
- php-coveralls/php-coveralls: ^2.4
- phpunit/phpunit: ^9.0
- schwarzer/php-code-style: ^1.0
This package is auto-updated.
Last update: 2024-10-27 03:00:28 UTC
README
Installation
You can install the package via composer:
composer require schwarzer/laravel-rules
Usage
Please consider reading the Laravel Docs first.
Have I Been Pwned
In the next major release you'll be able to set the API key by config.
This rule is inspired by valorin/pwned-validator.
Translation
Please add to your /resources/lang/{lang}/validation.php
file the following line:
English
'hibp' => 'The :attribute occurs at least :min times in a list of known passwords.',
Deutsch
'hibp' => 'Das :attribute kommt mindestens :min mal in einer Liste bekannter Passwörter vor.',
Short syntax
Validator::make($request->all(), [ 'password' => 'required|hibp', ]);
You can specify how often your password (hash) should be found min
imum in the HIBP results.
Validator::make($request->all(), [ 'password' => 'required|hibp:min=1', ]);
Class / Object syntax
Validator::make($request->all(), [ 'password' => ['required', new HaveIBeenPwned], ]);
You can specify how often your password (hash) should be found minimum in the HIBP results.
Validator::make($request->all(), [ 'password' => ['required', new HaveIBeenPwned(1)], ]);
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.