werkspot/kvk-api

PHP KVK API client

v0.1.3 2020-12-15 09:46 UTC

This package is auto-updated.

Last update: 2024-04-16 16:15:47 UTC


README

This package provides a simple integration of the Official KVK Api for your PHP project.

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version License

Installation

With composer, add:

$ composer require werkspot/kvk-api

ROOT CERTIFICATE

On October 28, 2020, the KVK started signing the SSL connection with a self signed certificate from the dutch government. To prevent this package from breaking current implementations; SSL verification will be disabled by default. If you would like to enable the verification of the SSL certificates you can implement the path to the certificate (included) as the 3rd parameter of the factory. When failing to do so a deprecation error wil be triggered (E_USER_DEPRECATED).

Usage

profile query

use Werkspot\KvkApi\Http\Endpoint\Production;
use Werkspot\KvkApi\Http\Search\ProfileQuery;
use Werkspot\KvkApi\KvkClientFactory;

$client = KvkClientFactory::create('<YOUR_API_KEY>', new Production(), '/path/to/dutch-government-certificate.pem');

$profileQuery = new ProfileQuery();
$profileQuery->setKvkNumber('18079951');

$kvkPaginator = $client->getProfile($profileQuery);

foreach ($kvkPaginator->getItems() as $company) {
    // {your code}
}

// get next set of data
$kvkPaginator = $client->getNextPage($kvkPaginator);

Search query

use Werkspot\KvkApi\Http\Endpoint\Production;
use Werkspot\KvkApi\Http\Search\SearchQuery;
use Werkspot\KvkApi\KvkClientFactory;

$client = KvkClientFactory::create('<YOUR_API_KEY>', new Production());


$searchQuery = new SearchQuery();
$searchQuery->setStreet('ABEBE Bikilalaan');
$kvkPaginator = $client->fetchSearch($searchQuery);

// get next set of data
$kvkPaginator = $client->getNextPage($kvkPaginator);

Tests

To run the tests you can use the make commands in the projects root.

$ make test-cs
$ make test-unit
$ make test-integration

You can also automatically fix the coding standards with:

$ make fix-cs

Author

KVK API has been created by LauLaman and is currently maintained by the developers at Werkspot.