{"id":24540676,"url":"https://github.com/mistralys/vies-vat-service","last_synced_at":"2025-03-16T05:43:28.425Z","repository":{"id":57017617,"uuid":"337002448","full_name":"Mistralys/vies-vat-service","owner":"Mistralys","description":"Wrapper for the VIES VAT service, to fetch the data as JSON.","archived":false,"fork":false,"pushed_at":"2021-06-11T07:27:39.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-22T18:14:37.645Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mistralys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-08T08:08:31.000Z","updated_at":"2022-04-28T19:05:50.000Z","dependencies_parsed_at":"2022-08-22T11:31:42.008Z","dependency_job_id":null,"html_url":"https://github.com/Mistralys/vies-vat-service","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fvies-vat-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fvies-vat-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fvies-vat-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mistralys%2Fvies-vat-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mistralys","download_url":"https://codeload.github.com/Mistralys/vies-vat-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830914,"owners_count":20354850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T18:14:39.439Z","updated_at":"2025-03-16T05:43:28.405Z","avatar_url":"https://github.com/Mistralys.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VIES VAT Service\n\nWrapper for the VIES VAT service, to fetch the data as JSON.\n\n## Fetching data\n\n###  Sending a request\n\nSimply call the endpoint with the `vatid` parameter:\n\n```\n/url/to/endpoint/?vatid=FR00000000\n```\n\nThe request always returns JSON, with the `status` key. This specifies\nif the request itself was successful, not whether the VAT ID is valid.\n\n### Successful request\n\nA successful request returns detailed data on the results. The relevant\npart is stored under `data \u003e result`. \n\n```json\n{\n  \"status\": \"success\",\n  \"data\": {\n    \"result\":{\n      \"vatID\":{\n        \"countryCode\":\"FR\",\n        \"number\":\"00000000\"\n      },\n      \"valid\":true,\n      \"identifier\":\"WJFS4465465SD\",\n      \"date\":\"2021-03-17T07:17:07+0100\",\n      \"companyName\":\"---\",\n      \"companyAddress\":\"---\"\n    },\n    \"requester\":{\n      \"name\":\"Company name\",\n      \"companyType\":\"\",\n      \"street\":\"Street address\",\n      \"city\":\"City\",\n      \"postcode\":\"00000\",\n      \"vatID\":{\n        \"countryCode\":\"FR\",\n        \"number\":\"000000\"\n      }\n    },\n    \"requesterMatch\":{\n      \"name\":\"\",\n      \"companyType\":\"\",\n      \"street\":\"\",\n      \"postcode\":\"\",\n      \"city\":\"\"\n    }\n  }\n}\n```\n\n  \u003e NOTE: The requester information is what has been specified in the\n    service configuration, in the `config.php`.\n\nFrom experience, the company name and address in the result set are missing\nmore often than not, so it's better not to rely on it. The same goes for\nthe requester match.\n\n### Failed request\n\nA request can fail for example if the VIES VAT service is down. The error\nmessage details the reason why.\n\n```json\n{\n  \"status\": \"error\",\n  \"message\": \"Error message\",\n  \"code\": 145\n}\n```\n\n\n## Parsing VAT ID strings\n\nThe static `VatID::parse()` method accepts formatted and unformatted VAT ID strings. It automatically strips most commonly used separator characters and whitespace.\n\nThe following examples all return a valid `VatID` instance:\n\n```php\nVatID::parse('FR 123 456 78');\nVatID::parse('FR-12345678');\nVatID::parse('[DE]12-34-56-78');\nVatID::parse('de12345678'); // Lowercase country code  \n```\n\n## Running the testsuite\n\nTo run the tests, first rename the `tests/config.dist.php` to `tests/config.php`, and fill out the necessary information to enable live tests against the VIES service.\n\nTests can be launched on Windows using `run-tests.bat`. On linux, run the following command:\n\n```\nvendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistralys%2Fvies-vat-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmistralys%2Fvies-vat-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmistralys%2Fvies-vat-service/lists"}