tylercd100 / laravel-validator-state
Validate that a states and provinces for US and Canada
Installs: 44
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/tylercd100/laravel-validator-state
Requires
- php: ^5.5.9|^7.0
- illuminate/support: ^5.0
- illuminate/validation: ^5.0
Requires (Dev)
- orchestra/testbench: ^3.2
- phpunit/phpunit: ^4.8|^5.0
This package is auto-updated.
Last update: 2025-10-12 12:44:12 UTC
README
This Package has moved to here for laravel 5.5+. Please use that instead. Also check out these other community validation rules
Installation
Install via composer - In the terminal:
composer require tylercd100/laravel-validator-state
Now add the following to the providers
array in your config/app.php
Tylercd100\Validator\State\ServiceProvider::class
Usage
# USA vs Canada Validator::make(['test' => 'UT'], ['test' => 'state']); //true Validator::make(['test' => 'UT'], ['test' => 'state:usa']); //true Validator::make(['test' => 'BC'], ['test' => 'state:canada']); //true # Abbreviation vs Full Validator::make(['test' => 'Utah'], ['test' => 'state:full']); //true Validator::make(['test' => 'UT'], ['test' => 'state:abbr']); //true # Mix and match Validator::make(['test' => 'UT'], ['test' => 'state:usa,abbr']); //true Validator::make(['test' => 'Alberta'], ['test' => 'state:canada,full']); //true