elvenpath / yii2-eu-vatvalidator
Yii2 validator for EU VAT numbers
Installs: 9 134
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.0
- ext-soap: *
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-10-26 19:27:00 UTC
README
An Yii2 validator for EU VAT numbers
EU VAT validator for Yii2
based on https://github.com/herdani/vat-validation
About
The
- Validate a VAT number
- Retrieve information like the name or the address of the company
The data is extracted from a European Commission webservice
It ONLY works for European Union countries
Requirements
PHP with Soap enabled
Install
composer require elvenpath/yii2-eu-vatvalidator
Usage
public function rules()
{
return [
[
'vat',
EuVatValidator::className(),
'country_code' => $this->country_code,
],
];
}
You can also populate the model with the company name and address got from the EU database
public function rules()
{
return [
[
'vat',
EuVatValidator::className(),
'country_code' => $this->country_code,
'populate_model' => true,
'model_name_attribute' => 'name',
'model_address_attribute' => 'address'
],
];
}
Disclaimer
Take a look at http://ec.europa.eu/taxation_customs/vies/viesdisc.do to know when/how you're allowed to use this service and his information