This package provides a simple client for consuming the OverheidIo Api.
The API documentation can be found on: https://overheid.io/documentatie. You can get an api-key here https://overheid.io/register
The recommended way to install Overheid-Io is through Composer.
composer require mstroink/overheid-io
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
use MStroink\OverheidIo\OverheidIoFactory;
$overheid = new OverheidIoFactory::create($apiKey);
Or use your own (authenticated) client. An adapter is required to be an implementation of \MStroink\OverheidIo\Http\HttpClientInterface
use MStroink\OverheidIo\OverheidIo;
$overheid = new OverheidIo($client);
// Get car info by licence plate
try {
$response = $overheid->rdw()->get('76-GP-LH');
} catch(\MStroink\OverheidIo\Exception\NotFoundException $e) {
var_dump($e->getMessage());
var_dump($e->getCode());
var_dump($e->getPrevious());
}
// Search
$rdw = $overheid->rdw();
$response = $rdw
->fields(['merk', 'voertuigsoort', 'kenteken', 'eerste_kleur'])
->query('*laren')
->queryFields(['merk'])
->search();
// Get bag info by bag id
try {
$response = $overheid->bag()->get('3015ba-nieuwe-binnenweg-10-a');
} catch(\MStroink\OverheidIo\Exception\NotFoundException $e) {
}
// Search
$bag = $overheid->bag();
$response = $bag
->filters(['postcode' => '3015BA'])
->search();
// Get company info by kvk id
try {
$response = $overheid->kvk()->get('hoofdvestiging-57842019-0000-van-der-lei-techniek-bv');
} catch(\MStroink\OverheidIo\Exception\NotFoundException $e) {
}
// Search
$response = $overheid->kvk()
->filters(['dossiernummer' => '52921506'])
->search();
// Suggest
$response = $overheid->kvk()
->fields(['handelsnaam'])
->limit(10)
->suggest('Valken');
$rdw = $overheid->rdw();
// Number of items returned in the response
$rdw->limit(100);
// Specify the page of results to return
$rdw->page(1);
// Control whether results are returned in ascending or descending order
$rdw->order('asc'); $rdw->order('desc');
// To limit the fields fetched, you can use the fields() method
$rdw->fields(['voertuigsoort', 'kenteken', 'merk', 'eerstekleur']);
//Filter results by value
$rdw->filters(['merk' => 'dikke-bmw']);
// Query for car brand ending with laren
$rdw->query('*laren');
// Apply this query on the merk field
$rdw->queryFields(['merk']);
// Execute
$rdw->search();
vendor/bin/phpunit