https://github.com/germaniakg/vatidno
PHP Interfaces and traits for VAT ID numbers · PHP 5.6, PHP 7
https://github.com/germaniakg/vatidno
interfaces traits vat-number
Last synced: 2 months ago
JSON representation
PHP Interfaces and traits for VAT ID numbers · PHP 5.6, PHP 7
- Host: GitHub
- URL: https://github.com/germaniakg/vatidno
- Owner: GermaniaKG
- Created: 2018-04-16T09:00:17.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T14:25:17.000Z (over 2 years ago)
- Last Synced: 2025-02-08T20:12:43.379Z (4 months ago)
- Topics: interfaces, traits, vat-number
- Language: PHP
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Germania KG · VAT ID Number
**Interfaces, traits, and filters for dealing with VAT ID numbers**
[](https://packagist.org/packages/germania-kg/vatidno)
[](https://packagist.org/packages/germania-kg/vatidno)
[](https://github.com/GermaniaKG/VatIdNo/actions/workflows/tests.yml)## Installation
```bash
$ composer require germania-kg/vatidno
```## Interfaces
### VatIdNoProviderInterface
Provides a method **VatIdNo** to retrieve the VATIN as string.
```php
use Germania\VatIdNo\VatIdNoProviderInterface;/**
* @return string
*/
public function getVatIdNo();
```### VatIdNoAwareInterface
Extends *VatIdNoProviderInterface* and provides a method **setVatIdNo**, allowing you to set the VATIN.
```php
use Germania\VatIdNo\VatIdNoProviderInterface;/**
* @param string $vatin
* @return self
*/
public function setVatIdNo( $vatin );
public function getVatIdNo();
```## Traits
### VatIdNoProviderTrait
Implements the **VatIdNoProviderInterface** and provides a public property **vatin:**
```php
use Germania\VatIdNo\VatIdNoProviderInterface;
use Germania\VatIdNo\VatIdNoProviderTrait;class MyClass implements VatIdNoProviderInterface {
use VatIdNoProviderTrait;
public function __construct( $vatin ) {
$this->vatin = $vatin;
}
}
```### VatIdNoAwareTrait
Implements the **VatIdNoAwareInterface**. Utilizes the *VatIdNoProviderTrait*.
```php
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
### 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*```php