rockbuzz / lara-custom-validation
Laravel custom validations
Installs: 4 876
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 2
Requires
- php: >=7.2
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
- squizlabs/php_codesniffer: ^3.2
README
Laravel custom validations
Requirements
- PHP >= 7.2.5
- Laravel 6+
Install
$ composer require rockbuzz/lara-custom-validation
Available rules
CNPJ
use Rockbuzz\LaraCustomValidation\Rules\CNPJ; public function rules() { return [ 'field' => [new CNPJ], ]; }
CPF
use Rockbuzz\LaraCustomValidation\Rules\CPF; public function rules() { return [ 'field' => [new CPF], ]; }
FullName
use Rockbuzz\LaraCustomValidation\Rules\FullName; public function rules() { return [ 'field' => [new FullName], ]; }
HaveLetters
use Rockbuzz\LaraCustomValidation\Rules\HaveLetters; public function rules() { return [ 'field' => [new HaveLetters], ]; }
HaveNumbers
use Rockbuzz\LaraCustomValidation\Rules\HaveNumbers; public function rules() { return [ 'field' => [new HaveNumbers], ]; }
HaveSpecialCharacters
use Rockbuzz\LaraCustomValidation\Rules\HaveSpecialCharacters; public function rules() { return [ 'field' => [new HaveSpecialCharacters], ]; }
MatchOldPassword
You can optionally pass two parameters in the constructor, the first is $ nullable which by default is false and the $user who by default is auth.
use Rockbuzz\LaraCustomValidation\Rules\MatchOldPassword; public function rules() { return [ 'field' => [new MatchOldPassword], ]; }
Slug
use Rockbuzz\LaraCustomValidation\Rules\Slug; public function rules() { return [ 'field' => [new Slug], ]; }
You can use the extension mode
public function rules() { return [ 'new_password' => 'match_old_password', ]; }
Style Code
composer cs
Testing
composer test
License
The Lara Custom Validation is open-sourced software licensed under the MIT license.