risan / lara-rules
Laravel custom validation rules.
v1.0.2
2022-03-02 16:25 UTC
Requires
- php: ^7.3|^8.0
- illuminate/contracts: ^8.0|^9.0
- illuminate/support: ^8.0|^9.0
README
Laravel custom validation rules.
Installation
This package requires you to use Laravel version 8. Install this package through Composer.
$ composer require risan/lara-rules
Usage
use Risan\LaraRules\USPhoneWithDash; $request->validate([ 'phone' => ['required', 'string', new USPhoneWithDash], // Valid: 123-456-7890 'state' => ['required', 'string', new USStateCode], // Valid: CA, TX 'zip_code' => ['required', 'string', new USZipCode], // Valid: 90120 or 20521-9000 ]);
USPhoneWithDash
: 10 digits of US phone number with dash.USStateCode
: 2 characters of US state code.USZipCode
: 5 or 9 digits of US zip code.