定制 belghiti/vies-client 二次开发

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

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

belghiti/vies-client

最新稳定版本:v0.1.1

Composer 安装命令:

composer require belghiti/vies-client

包简介

Core PSR-18 VIES (VoW) REST API client (Belghiti\Vies) with retry and DTOs.

README 文档

README

CI Packagist Downloads

A lightweight, framework‑agnostic PSR‑18 client for the European Commission’s VIES (VAT Information Exchange System) REST API.

  • DTOs for requests/responses (CheckVatRequest, CheckVatResponse, StatusInformationResponse)
  • Retry decorator (exponential backoff)
  • Contract test against the official Swagger (downloaded in CI)
  • Non‑fatal smoke test of GET /check-status to the public VIES REST base

Requirements

  • PHP 8.1+ (CI matrix covers 8.1 – 8.5)
  • Any PSR‑18 HTTP client + PSR‑17 factories (e.g., Guzzle + Nyholm PSR‑7)

Installation

composer require belghiti/vies-client
# (optional) choose a PSR-18 stack:
composer require guzzlehttp/guzzle guzzlehttp/psr7     # Guzzle PSR-18 + PSR-7
# or
composer require symfony/http-client nyholm/psr7       # Symfony Psr18Client + PSR-7

Quick start (Guzzle PSR‑18)

use Belghiti\Vies\Client\HttpViesClient;
use Belghiti\Vies\Support\Adapter\GuzzlePsr18Client;
use Belghiti\Vies\Dto\CheckVatRequest;
use GuzzleHttp\Client as Guzzle;
use GuzzleHttp\Psr7\HttpFactory;

$psr18   = new GuzzlePsr18Client(new Guzzle());
$factory = new HttpFactory();

$client = new HttpViesClient(
    http:           $psr18,
    requestFactory: $factory,
    streamFactory:  $factory,
    baseUri:        'https://ec.europa.eu/taxation_customs/vies/rest-api'
);

$res = $client->checkVatNumber(new CheckVatRequest('FR', '40303265045'));
var_dump($res->valid);

API surface

interface ViesClientInterface {
    public function checkVatNumber(CheckVatRequest $request): CheckVatResponse;
    public function checkVatTestService(CheckVatRequest $request): CheckVatResponse;
    public function checkStatus(): StatusInformationResponse;
}
  • CheckVatRequest matches the public contract fields (countryCode, vatNumber, optional requester* & trader fields)
  • checkStatus() returns overall VOW availability and per‑country availability entries

Retry & caching

  • Wrap the core client with Belghiti\Vies\Decorator\RetryingViesClient for exponential backoff
  • Add your own cache decorator, or use the Laravel/Symfony packages for prebuilt caching

Quality

composer lint   # PSR-12 via PHP_CodeSniffer
composer stan   # PHPStan (level max)
vendor/bin/phpunit

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固