Download the PHP package omisai/vies-soap without Composer
On this page you can find all versions of the php package omisai/vies-soap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package vies-soap
PHP VIES SOAP
A lightweight, type-safe PHP package for validating EU VAT numbers via the European Commission's VIES (VAT Information Exchange System) SOAP service.
Features
- ✅ Type-safe: Full PHP 8.1+ type declarations and modern enum support
- ✅ Comprehensive validation: Built-in country code and VAT number validation
- ✅ Production ready: Supports both production and test VIES services
- ✅ Error handling: Structured exceptions for SOAP faults and validation errors
- ✅ Approximate matching: Advanced VAT validation with trader details
- ✅ All EU countries: Support for all 27 EU member states plus Northern Ireland
- ✅ Tested: 100% test coverage with Pest PHP testing framework
Requirements
- PHP 8.1 or higher
- SOAP extension (
ext-soap) enabled
Installation
Install the package via Composer:
Quick Start
Basic VAT Validation
Using the Test Service
For development and testing, use the VIES test service:
Configuration
Environment Configuration
SOAP Client Options
You can pass additional SOAP client options to customize the HTTP requests:
API Reference
ViesClient
The main client class for interacting with VIES services.
Constructor
Methods
checkVat(string $countryCode, string $vatNumber): CheckVatResponse
Validates a VAT number and returns basic information.
Parameters:
$countryCode: Two-letter EU country code (e.g., 'DE', 'FR', 'NL')$vatNumber: The VAT number to validate
Returns: CheckVatResponse object
Example:
checkVatApprox(CheckVatApproxRequest $request): CheckVatApproxResponse
Performs approximate VAT validation with trader details for enhanced verification.
Parameters:
$request: ACheckVatApproxRequestobject with trader information
Returns: CheckVatApproxResponse object
Example:
Data Transfer Objects (DTOs)
CheckVatResponse
Contains the response from a basic VAT check.
Properties:
countryCode: string - The validated country codevatNumber: string - The validated VAT numberrequestDate: DateTimeImmutable - When the request was madevalid: bool - Whether the VAT number is validname: ?string - Company name (if available)address: ?string - Company address (if available)
CheckVatApproxResponse
Contains the response from an approximate VAT check with detailed matching information.
Properties:
countryCode: stringvatNumber: stringrequestDate: DateTimeImmutablevalid: booltraderName: ?stringtraderCompanyType: ?stringtraderAddress: ?stringtraderStreet: ?stringtraderPostcode: ?stringtraderCity: ?stringtraderNameMatch: ?string - Match confidence for nametraderCompanyTypeMatch: ?string - Match confidence for company typetraderStreetMatch: ?string - Match confidence for streettraderPostcodeMatch: ?string - Match confidence for postcodetraderCityMatch: ?string - Match confidence for cityrequestIdentifier: string - Unique identifier for the request
CheckVatApproxRequest
Request object for approximate VAT validation.
Constructor parameters:
countryCode: string (required)vatNumber: string (required)traderName: ?stringtraderCompanyType: ?stringtraderStreet: ?stringtraderPostcode: ?stringtraderCity: ?stringrequesterCountryCode: ?string - Your country's code for the requestrequesterVatNumber: ?string - Your VAT number for the request
Supported Countries
The package supports all current EU member states plus Northern Ireland (XI):
| Code | Country | Code | Country | Code | Country |
|---|---|---|---|---|---|
| AT | Austria | EL | Greece | MT | Malta |
| BE | Belgium | ES | Spain | NL | Netherlands |
| BG | Bulgaria | FI | Finland | PL | Poland |
| CY | Cyprus | FR | France | PT | Portugal |
| CZ | Czechia | HR | Croatia | RO | Romania |
| DE | Germany | HU | Hungary | SE | Sweden |
| DK | Denmark | IE | Ireland | SI | Slovenia |
| EE | Estonia | IT | Italy | SK | Slovakia |
| LV | Latvia | XI | Northern Ireland | ||
| LT | Lithuania | ||||
| LU | Luxembourg |
Country Code Validation
Error Handling
The package provides structured exception handling for different error scenarios.
Validation Errors
SOAP Service Errors
Common Exception Types
ViesValidationException: Invalid country code or VAT number formatViesSoapException: SOAP service errors (service unavailable, invalid requests, etc.)
Advanced Usage
Custom SOAP Client
You can inject custom SOAP client implementations for testing or advanced scenarios:
Custom Validation
Batch Processing
Testing
Run the test suite using Pest:
Testing with Mock Data
The package includes test helpers for mocking SOAP responses:
Performance Considerations
- The VIES service has rate limits - avoid excessive requests
- SOAP calls are synchronous and may take 1-5 seconds
- Consider caching valid VAT numbers to reduce API calls
- Use the test service for development to avoid affecting production quotas
Limitations
- Requires internet connection to VIES service
- SOAP extension must be enabled in PHP
- Service may be unavailable during maintenance windows
- Rate limiting applies to prevent abuse
- Some countries may have additional validation rules
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
Security
Please see SECURITY.md for details on reporting security vulnerabilities.
License
This package is open-sourced software licensed under the MIT license.
Sponsoring
If you find this package useful, please consider sponsoring the development: Sponsoring on GitHub
Your support helps us maintain and improve this open-source project!
Official VIES Documentation
All versions of vies-soap with dependencies
ext-soap Version *