PHP code example of mstroink / overheid-io

1. Go to this page and download the library: Download mstroink/overheid-io library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mstroink / overheid-io example snippets




use MStroink\OverheidIo\OverheidIoFactory;

$overheid = new OverheidIoFactory::create($apiKey);

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