appvise / kvk-api
PHP KVK API客户端
dev-main
2023-09-11 08:04 UTC
Requires
- php: ^7.3|^8.0
- ext-json: *
Requires (Dev)
- guzzlehttp/guzzle: ^6.3
- phpunit/phpunit: ^6.5
Suggests
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-09-11 09:56:50 UTC
README
截至2022年4月1日,有一些新的API可用于与KVK交互。这个库使这变得很容易。下面检查安装和使用细节。
文档
安装
通过composer安装此包
composer require appvise/kvk-api
可能您想将KVK(荷兰私人根CA - G1)证书安装到您的受信任链中。更多信息请参阅:证书信息
使用
搜索API
use Appvise\KvkApi\Http\SearchQuery; use Appvise\KvkApi\KvkClientFactory; use Appvise\KvkApi\Exception\ApiException; use Appvise\KvkApi\Exception\NotFoundException; // for more information check: // https://developers.kvk.nl/nl/support/tls-certificate-chain-trust-instructions $rootCertificate = <location_of_root_certificate>; $client = KvkClientFactory::create(<YOUR_API_KEY>, 'test | production', $rootCertificate); $query = new SearchQuery(); $query->setKvkNumber('KVK nummer to search for'); try { $resultaten = $this->client->search($query); foreach ($resultaten->getResultaten() as $searchResult) { // do something with $searchResult } } catch(NotFoundException | ApiException $exception) { // handle error }
基础配置文件API
use Appvise\KvkApi\Http\ProfileQuery; use Appvise\KvkApi\KvkClientFactory; use Appvise\KvkApi\Exception\ApiException; use Appvise\KvkApi\Exception\NotFoundException; // for more information check: // https://developers.kvk.nl/nl/support/tls-certificate-chain-trust-instructions $rootCertificate = <location_of_root_certificate>; $client = KvkClientFactory::create(<YOUR_API_KEY>, 'test | production', $rootCertificate); $query = new ProfileQuery(); $query->setKvkNumber('KVK nummer to fetch basis profile information for'); try { $basisProfile = $this->client->getBasisProfiel($query); // do something with $basisProfile } catch(NotFoundException | ApiException $exception) { // handle error }
测试
composer test