Skip to content

globtec/cpf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

The Cpf class

A CPF number is called a Cadastro de Pessoa Física or translated “Registration of a Physical Person” and with this class you can apply the validation of this number in your application and display its formatted value.

Usage

CPF number valid, the following code uses a hypothetical number

$cpf = new Cpf('06115058511');
$cpf->valid(); // true
$cpf->format(); // 061.150.585-11

You can set CPF number ignoring the digits from zero to left

$cpf->set(6115058511); 

You can set CPF number formatted

$cpf->set('061.150.585-11'); 

CPF number invalid

$cpf = new Cpf('21601543695'); 
$cpf->valid(); // false
$cpf->format(); // NULL

About

Class in PHP to work with CPF

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages