werkspot / kvk-api
PHP KVK API client
Installs: 12 566
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 26
Forks: 8
Open Issues: 3
Requires
- php: >=7.1
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.10
- guzzlehttp/guzzle: ^6.3
- mockery/mockery: ^1.0
- phpunit/phpunit: ^6.5
Suggests
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-11-16 17:33:05 UTC
README
This package provides a simple integration of the Official KVK Api for your PHP project.
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.