jbohme/vat-validator
最新稳定版本:1.0.0
Composer 安装命令:
composer require jbohme/vat-validator
包简介
A PHP package to validate VAT numbers for all countries.
README 文档
README
A PHP package to validate VAT numbers for all countries.
Support for:
| Country | Code(ISO 3166-1 alpha-2) | Natural Person | Legal Person |
|---|---|---|---|
| Brazil | BR | CPF | CNPJ |
Installation
Run in your project:
composer require jbohme/vat-validator
Usage
Simply use the helper functions for natural or legal persons. Pass the desired country code as the first parameter and then the document string.
<?php $cnpj = legal_person_document('BR', "48.300.733/0001-78"); // or $cpf = natural_person_document('BR', "550.371.510-15");
If the document is invalid, the DocumentInvalidException exception will be thrown; otherwise, the object is created.
Contribution
If you want to contribute with a document, pay attention to:
- Create the class in src/Documents/LegalPerson and/or src/Documents/NaturalPerson;
- Extend DocumentAbstract;
- Implement the logic in the isValid function;
- Map the class in country_mapping.php;
- Create the test following the pattern {CountryName}VatTest.php and implement the CountryVatTestInterface interface.
After making the changes, do the following:
- Fork the project;
- Create a branch for your modification (
git checkout -b feature/new-feature); - Commit your changes (
git commit -am 'Add new feature'); - Push to the branch (
git push origin feature/new-feature); - Open a pull request.
License
The Vat Validator is open-source software licensed under the MIT license.
统计信息
- 总下载量: 74
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-19