Download the PHP package rechtlogisch/evatr without Composer
On this page you can find all versions of the php package rechtlogisch/evatr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rechtlogisch/evatr
More information about rechtlogisch/evatr
Files in rechtlogisch/evatr
Package evatr
Short Description Checks a VAT-ID using the eVatR REST-API of the German Federal Central Tax Office (Bundeszentralamt für Steuern, BZSt)
License MIT
Homepage https://github.com/rechtlogisch/evatr-php
Informations about the package evatr
evatr
Checks a VAT-ID using the eVatR REST-API of the German Federal Central Tax Office (Bundeszentralamt für Steuern, BZSt)
[!CAUTION] This package is in early development and is not yet ready for production use. It is currently being tested and may undergo significant changes.
[!IMPORTANT] This is an unofficial wrapper for the eVatR API. For official documentation and terms of use, please refer to the German Federal Central Tax Office (BZSt) website.
[!NOTE] This package uses the new REST-API released in July 2025. The old XML-RPC API is being discontinued and will be sunset on November 30th, 2025 (based on information from BZSt-Newsletter USTKV 01/2025 dated July 1st, 2025).
Installation
You can install the package via composer:
Quick Start
Simple Validation
Validates only the VAT-ID without company data verification:
or alternatively use the helper function:
Qualified Confirmation
Validates VAT-ID and verifies company data:
or alternatively use the helper function:
Including Raw Response
or with helper functions
API Reference
Constructor
or alternatively using RequestDto:
Methods
check(): ResultDto
Performs the VAT-ID confirmation:
includeRaw(bool $value = true): self
Includes the raw API response in the result:
Response Object (ResultDto)
The check() method returns a ResultDto object with the following methods:
Status Codes
The API returns various status codes via the Status enum. All status codes are available as enum cases:
Validation Results (Qualified Confirmation)
For qualified confirmations, the response includes validation results for each field via the QualifiedResult enum:
- A - Data matches registered information
- B - Data does not match registered information
- C - Data was not requested
- D - Data not provided by the EU member state
Helper Functions
The package provides convenient helper functions:
checkVatId()
confirmVatId()
Field Mapping
The API uses German terms, which have been mapped to parameters:
Request
| BZSt API | evatr |
|---|---|
| anfragendeUstid | vatIdOwn |
| angefragteUstid | vatIdForeign |
| firmenname | company |
| ort | location |
| strasse | street |
| plz | zip |
Response
| BZSt API | evatr |
|---|---|
| id | id |
| anfrageZeitpunkt | timestamp |
| gueltigAb | dateFrom |
| gueltigBis | dateTill |
| ergFirmenname | company |
| ergStrasse | street |
| ergPlz | zip |
| ergOrt | location |
Language of status messages (EVATR_LANG)
By default, status messages (human-readable descriptions of evatr-* codes) are returned in German. To switch to English messages, set the following environment variable:
[!WARNING] This English translation of the status messages is unofficial. Use at your own risk.
Supported values:
- de (default): German messages
- en: English messages
This affects:
- Status::description()
- ResultDto->toArray()['message']
Additional endpoints and helpers
The client exposes supplementary endpoints of the eVatR API.
Status messages
Each StatusMessage item has the shape:
EU member states availability
Error Handling
All public API methods throw exceptions on failure, and return only DTOs on success.
- ErrorResponse: thrown for transport, server, or JSON/response parsing errors.
- InputError: thrown when the error is caused by invalid input, and can be potentially fixed by the user.
ErrorResponse exception
Thrown when a request fails due to transport or response parsing issues.
Fields:
- httpCode: int HTTP status or 0 for client-side failures
- error: string short description
- exception: Throwable the underlying/previous exception; if no underlying Throwable existed, a RuntimeException is used
- raw: ?string raw response body if available
- meta: array<string,mixed> additional context (e.g., endpoint, errorType)
Example:
Testing
Running Tests
Test Data
The library includes test VAT-IDs that can be used for development and testing:
Environment Variables
For testing with real VAT-IDs, you can set environment variables:
Rate Limits and Best Practices
- The API has rate limits. Implement appropriate delays between requests
- Cache results when possible to reduce API calls
- Handle all possible status codes in your application
- Always validate VAT-ID formats before making API calls
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Krzysztof Tomasz Zembrowski
- All Contributors
License
The MIT License (MIT). Please see License File for more information.