th3mouk/vatlayer

PHP wrapper of vatlayer.com

0.1.1 2021-02-26 10:52 UTC

This package is auto-updated.

Last update: 2024-10-26 20:32:35 UTC


README

This PHP library is a wrapper of vatlayer.com respecting PSR18/PSR17/PSR7.

Latest Stable Version Latest Unstable Version Total Downloads License

CI Scrutinizer Code Quality .gitattributes

Installation

composer require th3mouk/vatlayer

Usage

use Th3Mouk\VatLayer\Psr18Wrapper;

// Client respecting PSR18
// @see https://packagist.org/providers/psr/http-client-implementation
$http_client = WhateverYouWant();

// Request factory respecting PSR17
// @see https://packagist.org/providers/psr/http-factory-implementation
$request_factory = WhateverYouWantToo();

// Or automatically take an http client with
// composer require php-http/discovery
$http_client = Psr18ClientDiscovery::find();
$request_factory = Psr17FactoryDiscovery::findRequestFactory();

$wrapper = new Psr18Wrapper('access_key', $http_client, $request_factory);
$response = $wrapper->validate('vat_number');

Endpoints coverage

Original documentation

  • VAT Number Validation
  • Get VAT Rates via Country Code
  • Get VAT Rates via IP Address
  • Get VAT Rates via Client IP
  • Retrieve all EU VAT Rates
  • VAT Compliant Price Calculation