定制 kfoobar/laravel-euro-vat 二次开发

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

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

kfoobar/laravel-euro-vat

最新稳定版本:v1.0.1

Composer 安装命令:

composer require kfoobar/laravel-euro-vat

包简介

A Laravel package for Euro VAT validation

README 文档

README

A Laravel package for validating EU VAT numbers, including local format validation and online validation against the EU VIES API.

Installation

Install the package via Composer:

composer require kfoobar/laravel-euro-vat

Publish the configuration file:

php artisan vendor:publish --provider="KFoobar\EuroVAT\EuroVATServiceProvider"

Configuration

The configuration file config/euro-vat.php allows you to set:

  • urls.number: Endpoint used when validating a VAT number online.
  • urls.status: Endpoint used for the VIES status check.
  • ttl.number: Cache lifetime in minutes for VAT validation results.
  • ttl.status: Cache lifetime in minutes for VIES status results.

Usage

The main service exposes:

  • validate(string $number, ?string $country = null): ?string
  • validateOffline(string $number, ?string $country = null): ?string
  • validateOnline(string $number, string $country): ?string
  • status(?string $country = null): bool

Using the Facade

Validate a VAT number:

use KFoobar\EuroVAT\Facades\EuroVAT;

EuroVAT::validate('SE123456789012');
EuroVAT::validateOffline('SE123456789012');
EuroVAT::validateOnline('123456789012', 'SE');
EuroVAT::validate('123456789012', 'SE');
EuroVAT::status('SE');

validate() is the default entrypoint and performs online validation.

validateOffline() only performs the local VAT format check. No external HTTP request is made.

validateOnline() sends the provided VAT number and country code directly to the EU VIES API and caches the response. It does not normalize or pre-validate the VAT number locally.

Using the Validation Rule

use KFoobar\EuroVAT\Rules\VatId;

$request->validate([
    'vat_number' => ['required', new VatId('SE')],
]);

Using the vat_id Validator Extension

$request->validate([
    'vat_number' => 'required|vat_id:SE',
]);

Contributing

Contributions are welcome!

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固