Download the PHP package fernandorech/br-commons without Composer
On this page you can find all versions of the php package fernandorech/br-commons. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download fernandorech/br-commons
More information about fernandorech/br-commons
Files in fernandorech/br-commons
Download fernandorech/br-commons
More information about fernandorech/br-commons
Files in fernandorech/br-commons
Vendor fernandorech
Package br-commons
Short Description Helps creates CPF and CNPJ validations
License MIT
Package br-commons
Short Description Helps creates CPF and CNPJ validations
License MIT
Please rate this library. Is it a good library?
Informations about the package br-commons
BrCommons Validators
BrCommons validator is a set of useful validators that helps you develop fast and reliable code. Has zero dependencies.
Installation by composer
Run composer require fernandorech/br-commons
.
Updates
Has the new validation CNPJ Alfanumérico.
BrCommons
It's a class that helps you to validate and format CPF and CNPJ by given a string.
Examples 1: Simple document format
use BrCommons\BrCommons;
$document = BrCommons::from('44975583046');
echo $document->toString(); // will print '449.755.830-46'
Example 2: validation of a cpf
if(BrCommons::isValid('44975583046') {
// do some code
} else {
// other stuff
}
Example 3: throw an exception if a document is not valid
try {
$document = BrCommons::from('4497558', true); //it will thrown an exception
} catch (DocumentException $e) {
//do code
}
Example 4: Return formatted value without create an object
echo BrCommons::format('44975583046');
Example 5: Use CPF or CNPJ directly
$cpf = CPF::from('44975583046');
$cnpj CNPJ::from('14328920000148');
All versions of br-commons with dependencies
PHP Build Version
Package Version
No informations.
The package fernandorech/br-commons contains the following files
Loading the files please wait ....