laravel-validation-rules/us-state

Validate US States and Canada Provinces
190,739 16
Install
composer require laravel-validation-rules/us-state
Latest Version:1.9.0
Laravel:5 – 12
License:Apache-2.0
Last Updated:Apr 1, 2025
Links: GitHub  ·  Packagist
Maintainer: ssx

State

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!

Related Packages

laravel-validation-rules/phone

Validate that a phone number is in the correct format

387,805 69
tylercd100/laravel-validator-phone

Validate that a phone number is in the correct format

4,377 3
tylercd100/laravel-validator-state

Validate that a states and provinces for US and Canada

44 1
tylercd100/laravel-validator-color

Validate that a certain value is a valid CSS color string in Laravel 5

81,706 15
stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

63,024 28

Version History

Version Released PHP Laravel License
1.9.0 ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0 Apache-2.0
1.8.0 ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 Apache-2.0
1.7.0 ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0 Apache-2.0
1.6.0 ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0 Apache-2.0
1.5.0 ^5.5|^6.0|^7.0|^8.0|^9.0 Apache-2.0