PHP code example of elbgoods / laravel-swiss-canton-rule

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


use Elbgoods\SwissCantonRule\Rules\SwissCantonRule;

$rule = new SwissCantonRule(SwissCantonRule::FORMAT_ABBREVIATION);

use Elbgoods\SwissCantonRule\Rules\SwissCantonRule;

$rule = new SwissCantonRule(SwissCantonRule::FORMAT_ABBREVIATION, null, false);
$rule->nullable();

use Elbgoods\SwissCantonRule\Rules\SwissCantonAbbreviationRule;

$rule = new SwissCantonAbbreviationRule();

use Elbgoods\SwissCantonRule\Rules\SwissCantonZipCodeRule;

$rule = new SwissCantonZipCodeRule();

use Elbgoods\SwissCantonRule\Rules\SwissCantonNameRule;

$rule = new SwissCantonNameRule(); // all languages
$rule = new SwissCantonNameRule('de'); // german only
bash
php artisan vendor:publish --provider="Elbgoods\SwissCantonRule\SwissCantonRuleServiceProvider" --tag=lang