PHPackages                             omisai/laravel-vies-rest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. omisai/laravel-vies-rest

ActiveLibrary[HTTP &amp; Networking](/categories/http)

omisai/laravel-vies-rest
========================

Laravel adapter for the VIES REST API package

v1.3.0(2mo ago)1100MITPHPPHP ^8.1CI passing

Since Feb 11Pushed 2mo agoCompare

[ Source](https://github.com/omisai-tech/laravel-vies-rest)[ Packagist](https://packagist.org/packages/omisai/laravel-vies-rest)[ RSS](/packages/omisai-laravel-vies-rest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (5)Used By (0)

Laravel VIES REST
=================

[](#laravel-vies-rest)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c08fae79676a079c0c751433d5d934c4c3f82e81639bb374fae8b36327db0fb8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6d697361692f6c61726176656c2d766965732d726573742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omisai/laravel-vies-rest)[![License](https://camo.githubusercontent.com/458425f8985b0b0c8a736cffe75e05a098e3d77906acddbcad2bfc54492a4e02/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/sponsors/omisai-tech/LICENSE)[![Test](https://github.com/omisai-tech/laravel-vies-rest/actions/workflows/test.yml/badge.svg)](https://github.com/omisai-tech/laravel-vies-rest/actions/workflows/test.yml)[![PHP Version Require](https://camo.githubusercontent.com/5a7c3fe4812f22f94f5e0df5cf2ef1169288c850de4e43a80a2073ca8f96d65e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344382e312d626c75653f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://packagist.org/packages/omisai/laravel-vies-rest)

A Laravel adapter for the [VIES REST API package](https://github.com/omisai-tech/php-vies-rest), utilizing Laravel's HTTP client.

Features
--------

[](#features)

- **Type-safe**: PHP 8.1+ type declarations and modern enum support
- **Clean architecture**: DTOs, validation, and HTTP adapters
- **Production + test modes**: Switch services via `ViesConfig`
- **Error handling**: Structured exceptions for validation and REST errors
- **Approximate matching**: Trader detail matching support
- **All EU countries**: EU member states plus Northern Ireland
- **Tested**: Pest-based test suite

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- omisai/vies-rest (base package)
- illuminate/http v10 or higher (Laravel HTTP client)

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require omisai/laravel-vies-rest
```

Quick Start
-----------

[](#quick-start)

This package requires the base `omisai/vies-rest` package.

The `Omisai\LaravelViesRest\ViesRestServiceProvider` service provider automatically registers the Laravel HTTP client adapter. The `Omisai\ViesRest\ViesClient` will use Laravel's HTTP client instead of direct Guzzle.

### Via Dependency Injection

[](#via-dependency-injection)

```
...
use Omisai\ViesRest\ViesClient;
use Omisai\ViesRest\Enum\EuropeanUnionCountry;

class ExampleController extends Controller
{
    public function __construct(
        private ViesClient $viesClient,
    ) {}

    public function checkVat(Request $request)
    {
        $countryCode = $request->input('country_code');
        $vatNumber = $request->input('vat_number');

        $isValidCountryCode = EuropeanUnionCountry::validateCountryCode($countryCode);
        if (!$isValidCountryCode) {
            return response()->json(['error' => 'Invalid country code'], 400);
        }

        $response = $this->viesClient->checkVat($countryCode, $vatNumber);

        return response()->json([
            'valid' => $response->valid,
            'name' => $response->name,
            'address' => $response->address,
        ]);
    }
}
```

### Via Service Container Resolution

[](#via-service-container-resolution)

```
