belghiti / laravel-rest-vies
Laravel 12 integration for belghiti/vies-client (Belghiti\Vies).
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/belghiti/laravel-rest-vies
Requires
- php: >=8.2
- belghiti/vies-client: ^0.1
- guzzlehttp/guzzle: ^7.9
- guzzlehttp/psr7: ^2.6
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0
- pestphp/pest: ^3.0|^4.0
README
Laravel 12 integration for VIES: Service Provider + Facade + Validation Rule + Cache decorator. It wires the core belghiti/vies-client with retry and Laravel Cache.
Requirements
- Laravel 12.x
- PHP 8.2 – 8.5
Installation
composer require belghiti/laravel-rest-vies php artisan vendor:publish --tag=vies-config
config/vies.php
return [ 'base_uri' => env('VIES_BASE_URI', 'https://ec.europa.eu/taxation_customs/vies/rest-api'), 'cache_ttl' => (int) env('VIES_CACHE_TTL', 3600), ];
.env
VIES_BASE_URI=https://ec.europa.eu/taxation_customs/vies/rest-api VIES_CACHE_TTL=3600
Usage
Facade
use Vies; // Belghiti\Vies\Laravel\ViesFacade alias use Belghiti\Vies\Dto\CheckVatRequest; $res = Vies::checkVatNumber(new CheckVatRequest('FR', '40303265045')); if ($res->valid) { // ... }
Dependency Injection
use Belghiti\Vies\Client\ViesClientInterface; use Belghiti\Vies\Dto\CheckVatRequest; public function __construct(private ViesClientInterface $vies) {} public function __invoke() { $status = $vies->checkStatus(); // ... }
Validation Rule
use Belghiti\Vies\Laravel\Rules\ValidVatInVies; use Illuminate\Support\Facades\Validator; $validator = Validator::make( ['vat' => '40303265045'], ['vat' => [new ValidVatInVies(app(\Belghiti\Vies\Client\ViesClientInterface::class), 'FR')]] );
Notes
CheckVatRequestcovers the contract fields (countryCode,vatNumber, optional trader info)- The package caches
checkVatNumber()responses using your configured Laravel Cache store (TTL from config)
Quality
composer lint # PSR-12 composer stan # PHPStan level max vendor/bin/pest -d
License
MIT