This package provides a simple integration of the Official KVK Api for your PHP project.
With composer, add:
$ composer require yuyinitos/kvk-api
profile query
use Yuyinitos\KvkApi\Http\Endpoint\Production;
use Yuyinitos\KvkApi\Http\Search\ProfileQuery;
use Yuyinitos\KvkApi\KvkClientFactory;
$client = KvkClientFactory::create('<YOUR_API_KEY>', new Production());
$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 Yuyinitos\KvkApi\Http\Endpoint\Production;
use Yuyinitos\KvkApi\Http\Search\SearchQuery;
use Yuyinitos\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 Yuyinitos.