schwarzer / laravel-rules
Laravel Rules
Installs: 43
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/schwarzer/laravel-rules
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: 2025-10-27 05:42:14 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 minimum 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.