https://github.com/oefenweb/cakephp-vat-number-check-webservice
A VAT number check (Web Service) Plugin for CakePHP
https://github.com/oefenweb/cakephp-vat-number-check-webservice
cakephp plugin validation vat vat-number vat-validation
Last synced: 3 months ago
JSON representation
A VAT number check (Web Service) Plugin for CakePHP
- Host: GitHub
- URL: https://github.com/oefenweb/cakephp-vat-number-check-webservice
- Owner: Oefenweb
- License: mit
- Created: 2019-01-09T13:05:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-08T10:37:19.000Z (12 months ago)
- Last Synced: 2025-06-25T19:02:42.757Z (3 months ago)
- Topics: cakephp, plugin, validation, vat, vat-number, vat-validation
- Language: PHP
- Homepage:
- Size: 240 KB
- Stars: 1
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# VatNumberCheck (Web Service) plugin for CakePHP
[](https://travis-ci.org/Oefenweb/cakephp-vat-number-check-webservice)
[](https://travis-ci.org/Oefenweb/cakephp-vat-number-check-webservice)
[](https://codecov.io/gh/Oefenweb/cakephp-vat-number-check-webservice)
[](https://packagist.org/packages/oefenweb/cakephp-vat-number-check-webservice)
[](https://codeclimate.com/github/Oefenweb/cakephp-vat-number-check-webservice)
[](https://scrutinizer-ci.com/g/Oefenweb/cakephp-vat-number-check-webservice/?branch=master)[Technical information](https://ec.europa.eu/taxation_customs/vies/#/technical-information)
## Requirements
* CakePHP 2.9.0 or greater.
* PHP 7.0.0 or greater.## Installation
Clone/Copy the files in this directory into `app/Plugin/VatNumberCheck`
## Configuration
Ensure the plugin is loaded in `app/Config/bootstrap.php` by calling:
```php
CakePlugin::load('VatNumberCheck', ['routes' => true]);
```Ensure to configure the following lines in `app/Config/database.php`:
```php
public $vatNumberCheckWebservice = [
'datasource' => 'VatNumberCheck.SoapSource',
'wsdl' => 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl',
'default_socket_timeout' => 2,
'connection_timeout' => 2,
];
```## Usage
### Model
Normalizes a VAT number:
```php
$vatNumber = $this->VatNumberCheck->normalize($vatNumber);
```Checks a given VAT number:
```php
$vatNumberValid = $this->VatNumberCheck->check($vatNumber);
```### Helper
Generates a VAT number check form field:
```php
echo $this->VatNumberCheck->input('vat_number', ['label' => __('VAT number')]);
```