This package provides a simple integration of the Official KVK Api for your PHP project.
With composer, add:
$ composer require werkspot/kvk-api
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).
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);
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
KVK API has been created by LauLaman and is currently maintained by the developers at Werkspot.