PHP Class DragonBe\Vies\Vies

This class provides a soap client for usage of the VIES web service provided by the European Commission to validate VAT numbers of companies registered within the European Union
Show file Open project: dragonbe/vies Class Usage Examples

Protected Properties

Property Type Description
$heartBeat A heartbeat checker to verify if the VIES service is available
$options Options for the SOAP client
$soapClient SoapClient
$wsdl The WSDL for VIES service

Public Methods

Method Description
filterVat ( string $vatNumber ) : string Filters a VAT number and normalizes it to an alfanumeric string
getHeartBeat ( ) : HeartBeat Retrieves the heartbeat class that offers the option to check if the VIES service is up-and-running.
getOptions ( ) : array Retrieves the options for the PHP SOAP service
getSoapClient ( ) : SoapClient Retrieves the SOAP client that will be used to communicate with the VIES SOAP service.
getWsdl ( ) : string Retrieves the location of the WSDL for the VIES SOAP service
listEuropeanCountries ( ) : array A list of European Union countries as of January 2015
setHeartBeat ( HeartBeat $heartBeat ) Sets the heartbeat functionality to verify if the VIES service is alive or not, especially since this service tends to have a bad reputation of its availability.
setOptions ( array $options ) : Vies Set options for the native PHP Soap Client
setSoapClient ( SoapClient $soapClient ) : Vies Sets the PHP SOAP Client and allows you to override the use of the native PHP SoapClient for testing purposes or for better integration in your own application.
setWsdl ( string $wsdl ) : Vies Sets the location of the WSDL for the VIES SOAP Service
validateVat ( string $countryCode, string $vatNumber, string $requesterCountryCode = null, string $requesterVatNumber = null ) : CheckVatResponse Validates a given country code and VAT number and returns a \DragonBe\Vies\CheckVatResponse object
validateVatSum ( string $countryCode, string $vatNumber ) : boolean Validate a VAT number control sum

Method Details

filterVat() public static method

Filters a VAT number and normalizes it to an alfanumeric string
public static filterVat ( string $vatNumber ) : string
$vatNumber string
return string

getHeartBeat() public method

Retrieves the heartbeat class that offers the option to check if the VIES service is up-and-running.
public getHeartBeat ( ) : HeartBeat
return HeartBeat

getOptions() public method

Retrieves the options for the PHP SOAP service
public getOptions ( ) : array
return array

getSoapClient() public method

Retrieves the SOAP client that will be used to communicate with the VIES SOAP service.
public getSoapClient ( ) : SoapClient
return SoapClient

getWsdl() public method

Retrieves the location of the WSDL for the VIES SOAP service
public getWsdl ( ) : string
return string

listEuropeanCountries() public static method

A list of European Union countries as of January 2015
public static listEuropeanCountries ( ) : array
return array

setHeartBeat() public method

Sets the heartbeat functionality to verify if the VIES service is alive or not, especially since this service tends to have a bad reputation of its availability.
public setHeartBeat ( HeartBeat $heartBeat )
$heartBeat HeartBeat

setOptions() public method

Set options for the native PHP Soap Client
public setOptions ( array $options ) : Vies
$options array
return Vies

setSoapClient() public method

Sets the PHP SOAP Client and allows you to override the use of the native PHP SoapClient for testing purposes or for better integration in your own application.
public setSoapClient ( SoapClient $soapClient ) : Vies
$soapClient SoapClient
return Vies

setWsdl() public method

Sets the location of the WSDL for the VIES SOAP Service
public setWsdl ( string $wsdl ) : Vies
$wsdl string
return Vies

validateVat() public method

Validates a given country code and VAT number and returns a \DragonBe\Vies\CheckVatResponse object
public validateVat ( string $countryCode, string $vatNumber, string $requesterCountryCode = null, string $requesterVatNumber = null ) : CheckVatResponse
$countryCode string The two-character country code of a European member country
$vatNumber string The VAT number (without the country identification) of a registered company
$requesterCountryCode string The two-character country code of a European member country
$requesterVatNumber string The VAT number (without the country identification) of a registered company
return CheckVatResponse

validateVatSum() public method

Validate a VAT number control sum
public validateVatSum ( string $countryCode, string $vatNumber ) : boolean
$countryCode string The two-character country code of a European member country
$vatNumber string The VAT number (without the country identification) of a registered company
return boolean

Property Details

$heartBeat protected property

A heartbeat checker to verify if the VIES service is available
protected $heartBeat

$options protected property

Options for the SOAP client
protected $options

$soapClient protected property

protected SoapClient $soapClient
return SoapClient

$wsdl protected property

The WSDL for VIES service
protected $wsdl