PHPackages                             germania-kg/vatidno - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. germania-kg/vatidno

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

germania-kg/vatidno
===================

Interfaces and traits for VAT ID numbers.

1.3.0(3y ago)0103proprietaryPHPPHP ^7.0|^8.0

Since Apr 16Pushed 3y ago2 watchersCompare

[ Source](https://github.com/GermaniaKG/VatIdNo)[ Packagist](https://packagist.org/packages/germania-kg/vatidno)[ RSS](/packages/germania-kg-vatidno/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (9)Used By (0)

Germania KG · VAT ID Number
===========================

[](#germania-kg--vat-id-number)

**Interfaces, traits, and filters for dealing with VAT ID numbers**

[![Packagist](https://camo.githubusercontent.com/04e108ac724b03eb9ae441e3b75f13480450e4dd2684f1d9348ac69d277626e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765726d616e69612d6b672f76617469646e6f2e7376673f7374796c653d666c6174)](https://packagist.org/packages/germania-kg/vatidno)[![PHP version](https://camo.githubusercontent.com/7f45a1e63131ef60db2fea96f6521633015bcb44d2077ef746f4c1233f89bc46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6765726d616e69612d6b672f76617469646e6f2e737667)](https://packagist.org/packages/germania-kg/vatidno)[![Tests](https://github.com/GermaniaKG/VatIdNo/actions/workflows/tests.yml/badge.svg)](https://github.com/GermaniaKG/VatIdNo/actions/workflows/tests.yml)

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

[](#installation)

```
$ composer require germania-kg/vatidno
```

Interfaces
----------

[](#interfaces)

### VatIdNoProviderInterface

[](#vatidnoproviderinterface)

Provides a method **VatIdNo** to retrieve the VATIN as string.

```
use Germania\VatIdNo\VatIdNoProviderInterface;

/**
 * @return string
 */
public function getVatIdNo();
```

### VatIdNoAwareInterface

[](#vatidnoawareinterface)

Extends *VatIdNoProviderInterface* and provides a method **setVatIdNo**, allowing you to set the VATIN.

```
use Germania\VatIdNo\VatIdNoProviderInterface;

/**
 * @param  string $vatin
 * @return self
 */
public function setVatIdNo( $vatin );
public function getVatIdNo();
```

Traits
------

[](#traits)

### VatIdNoProviderTrait

[](#vatidnoprovidertrait)

Implements the **VatIdNoProviderInterface** and provides a public property **vatin:**

```
use Germania\VatIdNo\VatIdNoProviderInterface;
use Germania\VatIdNo\VatIdNoProviderTrait;

class MyClass implements VatIdNoProviderInterface {

	use VatIdNoProviderTrait;

	public function __construct( $vatin ) {
		$this->vatin = $vatin;
	}
}
```

### VatIdNoAwareTrait

[](#vatidnoawaretrait)

Implements the **VatIdNoAwareInterface**. Utilizes the *VatIdNoProviderTrait*.

```
use Germania\VatIdNo\VatIdNoAwareInterface;
use Germania\VatIdNo\VatIdNoAwareTrait;

class MyClass implements VatIdNoAwareInterface {
	use VatIdNoAwareTrait;
}

// Simple example
$object1 = new MyClass;
$object1->setVatIdNo( "XY000000" );

// Fluent interface
echo $object1->setVatIdNo( "XY000000" )->vatin;

// Setting using VatIdNoProviderInterface
$object2 = new MyClass;
$object2->setVatIdNo( $object1 );
```

Filters
-------

[](#filters)

### WithVatIdNoFilterIterator

[](#withvatidnofilteriterator)

Filter for records that *do provide* a VATIN. These may be:

- Arrays with `vatin` key, and non-empty value
- Objects with `vatin` property, and non-empty value
- Instances of `VatIdNoProviderInterface` where *getVatIdNo* results *not empty*

```
