mateusjunges/cpf-cnpj-validator
最新稳定版本:v1.0.0
Composer 安装命令:
composer require mateusjunges/cpf-cnpj-validator
包简介
A simple class to validate CPF and CNPJ numbers
README 文档
README
This package provide a simple API to validate brazilian CPF and CNPJ document numbers.
Sponsor my work!
If you think this package helped you in any way, you can sponsor me on GitHub!
Installation
You can install this package using composer:
composer require mateusjunges/cpf-cnpj-validator
Usage
To validate a document number, you can invoke the Validator class passing the number and optionally the document type as parameters:
use Junges\CpfCnpjValidator\Validator; $v = (new Validator)("360.928.960-01"); // True $v = (new Validator)("360.928.960-01", \Junges\CpfCnpjValidator\Enums\TaxId::CPF); // True $v = (new Validator)("360.928.960-01", \Junges\CpfCnpjValidator\Enums\TaxId::CNPJ); // False $v = (new Validator)("91.881.588/0001-95"); // True $v = (new Validator)("91.881.588/0001-95", \Junges\CpfCnpjValidator\Enums\TaxId::CNPJ); // True $v = (new Validator)("91.881.588/0001-95", \Junges\CpfCnpjValidator\Enums\TaxId::CPF); // True
Testing
Run composer test to test this package.
Credits
License
This package is open-sourced software licensed under the MIT License. Please see the License file for more information.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-19

