PHP code example of tylercd100 / laravel-validator-state

1. Go to this page and download the library: Download tylercd100/laravel-validator-state library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tylercd100 / laravel-validator-state example snippets


Tylercd100\Validator\State\ServiceProvider::class

# 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