定制 burtds/laravel-vatnumber-checker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

burtds/laravel-vatnumber-checker

最新稳定版本:v1.0.7

Composer 安装命令:

composer require burtds/laravel-vatnumber-checker

包简介

A simple VAT Number checker package for Laravel.

README 文档

README

Latest Version on Packagist GitHub Workflow Status Total Downloads

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.

统计信息

  • 总下载量: 95.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 61
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 60
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-19