burtds/laravel-vatnumber-checker
Composer 安装命令:
composer require burtds/laravel-vatnumber-checker
包简介
A simple VAT Number checker package for Laravel.
README 文档
README
About laravel-vatnumber-checker
A small package that allows you to easily retrieve information associated with a VAT number. Verification of validity, company name, and address of the company is only one api call away.
How to use laravel-vatnumber-checker
Installation
You can install the package via composer:
composer require burtds/laravel-vatnumber-checker
Afterwords, you're able to fetch your desired information.
Usage
This packages uses an API provided by the European Commission called "VIES".
We'll need to import the Facade of this package on top of your file.
use Burtds\VatChecker\Facades\VatChecker
Once that is done, you'll be able to use the provide functions. For this example we're using the VAT Number of Vulpo BV.
$validVatNumber = '0749617582' // Vulpo BV's VAT number // returns a raw response of the European Commission's API VatChecker::getRawVatInstance('BE', $validVatNumber); // returns the validity of a VAT number VatChecker::isVatValid('BE', $validVatNumber); // returns the company name related to the VAT number VatChecker::getCompanyName('BE', $validVatNumber); // returns the company address related to the VAT number VatChecker::getCompanyAddress('BE', $validVatNumber);
There is also single parameter support for all methods.
$validVatNumber = 'BE0749617582' // Vulpo BV's VAT number // returns a raw response of the European Commission's API VatChecker::getRawVatInstance($validVatNumber); // returns the validity of a VAT number VatChecker::isVatValid($validVatNumber); ...
Validation Rule
This package also provides a simple validation rule.
use Burtds\VatChecker\Rules\VatNumber; $validatedData = $request->validate([ 'vat_number' => ['required', new VatNumber], ]);
This example will pass the validation when the provided vat number is valid. If not, it will return a neat error message.
Testing & Code Formatting
For testing you can run:
composer test
For formatting the code using Laravel Pint you can run:
composer format
Security Vulnerabilities
If you discover a security vulnerability within this package, please send me an e-mail via bert@bert.gent. I'll get back at you as soon as possible.
Credits
License
This package is open-sourced software licensed under the MIT license.
burtds/laravel-vatnumber-checker 适用场景与选型建议
burtds/laravel-vatnumber-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 155.81k 次下载、GitHub Stars 达 66, 最近一次更新时间为 2024 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 burtds/laravel-vatnumber-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 burtds/laravel-vatnumber-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 155.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 67
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-19