2017 © Pedro Peláez
 

library eu-vat-id-validation

EU VIES VAT Validation

image

pilou/eu-vat-id-validation

EU VIES VAT Validation

  • Friday, November 25, 2016
  • by pilou
  • Repository
  • 1 Watchers
  • 0 Stars
  • 82 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 9 Versions
  • 19 % Grown

The README.md

Getting Started

composer require pilou/eu-vat-id-validation, (*1)


Options / Functions

__construct()

  • param: string $vatId [optional]

setVatId()

  • param: string $vatId
  • throws: \Exception

Sets the current VAT-ID value and extracts the VAT-Number and the country code from it., (*2)


getVatId()

  • return: string

Gets the last set VAT-ID value., (*3)


toArray()

  • return: array

Gets the last set VAT-ID value and all associated details: - VAT-ID - VAT-Number - Country code - Is valid? - Company name (not always available) - Company address (not always available), (*4)

Example:, (*5)

Array (
    [vatId] => IT01775560442
    [vatNumber] => 01775560442
    [countryCode] => IT
    [isValid] => 1
    [companyName] => M.A.B. SOFTWARE SRL
    [companyAddress] => C DA CAMPIGLIONE 20 63900 FERMO FM
)

isValid()

  • return: boolean
  • throws: '\Pilou\EuVat\ServiceUnavailableException'

Usage Examples

Check if passed VAT-ID is valid:, (*6)

$vatId = new \Pilou\EuVat\Validation('IT01775560442');  
print_r($vatId->isValid());

// Output
true

Check multiple VAT-ID's:, (*7)

$vatId = new \Pilou\EuVat\Validation;

$vatId->setVatId('IT01775560442');
print_r($vatId->isValid());             // Output: true

$vatId->setVatId('XX123456789');
print_r($vatId->isValid());             // Output: false

Display all VAT-ID details:, (*8)

$vatId = new \Pilou\EuVat\Validation('IT01775560442');
print_r($vatId->toArray());

// Output
Array (
    [vatId] => IT01775560442
    [vatNumber] => 01775560442
    [countryCode] => IT
    [isValid] => 1
    [companyName] => M.A.B. SOFTWARE SRL
    [companyAddress] => C DA CAMPIGLIONE 20 63900 FERMO FM
)

Using all public class functions:, (*9)

$vatId = new \Pilou\EuVat\Validation;
$vatId->setVatId('IT01775560442');
$vatId->validate();

print_r($vatId->isValid());             // Output: true
print_r($vatId->getVatId());            // Output: 'IT01775560442'

print_r($vatId->toArray());

// Output
Array (
    [vatId] => IT01775560442
    [vatNumber] => 01775560442
    [countryCode] => IT
    [isValid] => 1
    [companyName] => M.A.B. SOFTWARE SRL
    [companyAddress] => C DA CAMPIGLIONE 20 63900 FERMO FM
)

The Versions

25/11 2016

dev-master

9999999-dev

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.4

 

The Development Requires

25/11 2016

0.2.4

0.2.4.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.4

 

The Development Requires

02/11 2016

0.2.3

0.2.3.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires

02/11 2016

0.2.2

0.2.2.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires

02/11 2016

0.2.1

0.2.1.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires

02/11 2016

0.2.0

0.2.0.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires

28/10 2016

0.1.3

0.1.3.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires

27/10 2016

0.1.2

0.1.2.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires

27/10 2016

0.1.0

0.1.0.0

EU VIES VAT Validation

  Sources   Download

The Requires

  • php >=5.5

 

The Development Requires