lumenpink/typesbr
Lumenpink/Typesbr
Common types for Brazilian Documents and Numbers (only CPF for now)
Installation
Install it usingo composer
composer require lumenpink/typesbr
Usage
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)
}
Testing
We love the PEST Suite by Nuno Maduro
To ruyn the tests just type:
vendor/bin/pest
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
644,549,754
9,698
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
423,477,751
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
399,241,428
4,660
Version History
| Version | Released | License |
|---|---|---|
| 0.0.3 | MIT | |
| 0.0.2 | MIT | |
| 0.0.1 | MIT |