PHP code example of lumenpink / typesbr
1. Go to this page and download the library: Download lumenpink/typesbr 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/ */
lumenpink / typesbr example snippets
use Lumenpink/Typesbr/Cpf
# Create new CPF
$cpf = new Cpf('000.000.001-91') // it accepts with or without mask or leading zeroes
// it throwns an InvalidArgumentException if invalid
# Return only digits
$cpf->digits(); // returns 00000000191
# Or the formatted (masked) version
$Cpf->formated(); // returns 000.000.001-91
# Return the type of document
$Cpf->type(); // returns 'cpf'
# Use it as primitive type on a function
function foo (Cpf $cpf) {
do_something_with_this_shining_new_and_valid_cpf($cpf)
}