yuyinitos/kvk-api

PHP KVK API client

v0.1.2 2019-06-18 15:31 UTC

This package is auto-updated.

Last update: 2024-11-05 04:18:24 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 yuyinitos/kvk-api

Usage

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);

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 Yuyinitos.