PHP code example of elbgoods / laravel-country-rule

1. Go to this page and download the library: Download elbgoods/laravel-country-rule 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/ */

    

elbgoods / laravel-country-rule example snippets


use Elbgoods\CountryRule\Rules\CountryRule;
use League\ISO3166\ISO3166;

$rule = new CountryRule(ISO3166::KEY_ALPHA2);

use Elbgoods\CountryRule\Rules\CountryRule;
use League\ISO3166\ISO3166;

$rule = new CountryRule(ISO3166::KEY_ALPHA2, false);
$rule->nullable();

use Elbgoods\CountryRule\Rules\CountryAlpha2Rule;

$rule = new CountryAlpha2Rule();

use Elbgoods\CountryRule\Rules\CountryAlpha3Rule;

$rule = new CountryAlpha3Rule();

use Elbgoods\CountryRule\Rules\CountryNameRule;

$rule = new CountryNameRule();

use Elbgoods\CountryRule\Rules\CountryNumericRule;

$rule = new CountryNumericRule();
bash
php artisan vendor:publish --provider="Elbgoods\CountryRule\CountryRuleServiceProvider" --tag=lang