PHP code example of jeandepaula / country-validations

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

    

jeandepaula / country-validations example snippets




use CountryValidations\CountryValidator;

$validator = new CountryValidator();

$validator->brazil()->personal()->cpf('123.456.789-09');       // true
$validator->brazil()->company()->cnpj('12.ABC.345/01DE-35');   // true
$validator->brazil()->address()->cep('01310-100');             // true
$validator->brazil()->address()->state('SP');                 // true
$validator->brazil()->personal()->phone('+55 (11) 98765-4321');// true

$validator->canada()->personal()->sin('046-454-286');         // true
$validator->canada()->address()->postalCode('K1A 0B1');        // true
$validator->canada()->address()->province('ON');              // true
$validator->canada()->bank()->routingNumber('000412345');     // true

$validator->usa()->personal()->ssn('123-45-6789');             // true
$validator->usa()->address()->zipCode('00501');               // true
$validator->usa()->bank()->routingNumber('021000021');        // true
$validator->country('US')->bank()->cardNumber('4111111111111111'); // true


$validator = new CountryValidator([
    'ispb' => [
        '00000000' => 'Banco do Brasil',
        '00360305' => 'Caixa Economica Federal',
    ],
]);
$validator->brazil()->bank()->ispb('00360305'); // true


$this->app->singleton(\CountryValidations\CountryValidator::class, function () {
    return new \CountryValidations\CountryValidator();
});