laravel-validation-rules / us-state
Validate US States and Canada Provinces
Installs: 125 018
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 5
Forks: 6
Open Issues: 1
Requires
- illuminate/contracts: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^3.5|^4.0|^5.0|^7.0|^8.0|^9.0
- phpunit/phpunit: ^7.0|^8.0|^9.0|^10.5
README
Validate US States, Canada Provinces, and Mexico States
Installation
composer require laravel-validation-rules/us-state
Usage
use LVR\State\Abbr; use LVR\State\Full; # Abbreviation vs Full $request->validate(['test' => 'UT'], ['test' => new Abbr]); // Pass! $request->validate(['test' => 'BC'], ['test' => new Abbr); // Pass! $request->validate(['test' => 'SON'], ['test' => new Abbr); // Pass! $request->validate(['test' => 'Utah'], ['test' => new Full]); // Pass! $request->validate(['test' => 'Alberta'], ['test' => new Full]); // Pass! $request->validate(['test' => 'Sonora'], ['test' => new Full]); // Pass! # Abbreviation - USA vs Canada vs Mexico $request->validate(['test' => 'UT'], ['test' => new Abbr]); // Pass! $request->validate(['test' => 'UT'], ['test' => new Abbr('US')]); // Pass! $request->validate(['test' => 'BC'], ['test' => new Abbr('CA')); // Pass! $request->validate(['test' => 'SON'], ['test' => new Abbr('MX')); // Pass! # Full - USA vs Canada vs Mexico $request->validate(['test' => 'Utah'], ['test' => new Full('US')]); // Pass! $request->validate(['test' => 'Alberta'], ['test' => new Full('CA')]); // Pass! $request->validate(['test' => 'Sonora'], ['text' => new Full('MX')]); // Pass!