PHP code example of mrcnpdlk / validator

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

    

mrcnpdlk / validator example snippets


composer 

$res = new \mrcnpdlk\Validator\Types\Pesel('12271402999');
var_dump($res->get()); //return parsed and cleaned string
var_dump($res->getBirthDate()); //return date in format YYY-MM-DD
var_dump($res->getAge()); //return int
var_dump($res->getSex()); //return F/M char

$res = new \mrcnpdlk\Validator\Types\Nip('362-005-44-28');
var_dump($res->get()); //return parsed and cleaned string (3620054428)
var_dump($res->getTaxOffice()); //return Tax Office name (Urząd Skarbowy Poznań-Nowe Miasto)

$res = new \mrcnpdlk\Validator\Types\Regon('331501');
var_dump($res->get()); //return parsed and cleaned string (000331501)
var_dump($res->getShort()); //return short number (000331501)
var_dump($res->getLong()); //return long number (00033150100000)


$oNrb = new \mrcnpdlk\Validator\Types\Nrb('13 1020 2791 2123 5389 7801 0731');
var_dump($oNrb->get());
var_dump($oNrb->getBank());
var_dump($oNrb->getBankDepartment());

$oPhone = new \mrcnpdlk\Validator\Types\Phone('48 42 6742222');
var_dump($oPhone->isMobile());
var_dump($oPhone->isFixed());
var_dump($oPhone->isPremiumRate());
var_dump($oPhone->isTollFree());
var_dump($oPhone->isSharedCost());
var_dump($oPhone->isUAN());
var_dump($oPhone->isVoip());
var_dump($oPhone->getInternationalFormat());
var_dump($oPhone->getNationalFormat());
var_dump($oPhone->getRegion());