jeffreymoelands/overheid-io

此包的最新版本(dev-master)没有可用的许可证信息。

overheid.io 库

dev-master 2017-03-14 12:55 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:44:19 UTC


README

此包提供使用 overheid-io API 的库。

API 文档可以在 https://overheid.io/documentatie 找到。此 API 需要认证,您可以通过在网站上注册来获取 API 密钥。

安装

使用 composer 安装

composer require jeffreymoelands/overheid-io

使用方法

安装后,您可以将 OverheidIo 注入到您的项目中以访问所有资源

use Jeffreymoelands\OverheidIo;

$overheid = new OverheidIo($api_key);

或者您可以直接调用每个资源以访问它们

// init voertuig resource
use Jeffreymoelands\OverheidIo\Recources\Voertuig;
$voertuig = new Voertuig($api_key);

// init kvk resource
use Jeffreymoelands\OverheidIo\Recources\Kvk;
$voertuig = new Kvk($api_key);

// init bag resource
use Jeffreymoelands\OverheidIo\Recources\Bag;
$voertuig = new Bag($api_key);

资源 Voertuig

$overheid = new OverheidIo($api_key);

// get car information by licence plate
$response = $overheid->voertuig()->get('76-GP-LH');

// search for car information (for applying filters see section filtering below)
$response = $overheid->voertuig()->search();

资源 Bag

$overheid = new OverheidIo($api_key);

// get bag information by bag id
$response = $overheid->bag()->get('3015ba-nieuwe-binnenweg-10-a');

// search for bag information (for applying filter see section filtering below)
$response = $overheid->bag()->search();

// suggest function can used for autocomplete purposes 
$response = $overheid->bag()->suggest('Valken');

资源 KVK

$overheid = new OverheidIo($api_key);

// get kvk information by dossier number and subdossier number
$response = $overheid->kvk()->get('22063560', '0000');

// search for kvk information (for applying filter see section filtering below)
$response = $overheid->kvk()->search();

// suggest function can used for autocomplete purposes 
$response = $overheid->kvk()->suggest('Valken');

筛选

对于筛选每个资源的搜索功能,您可以调用以下筛选函数

// for example we create the vervoer resource directly
use Jeffreymoelands\OverheidIo\Recources\Voertuig;
$voertuig = new Voertuig($api_key);

// filter for 100 items
$voertuig->size(100);

// filter for page 1
$voertuig->page(1);

// set ordering
$voertuig->order(100);

// add the fields merk and eerstkleur
$voertuig->fields(['merk', 'eerstekleur']);

// filters for bmw
$voertuig->filter(['merk' => 'BMW']);

// query for car brand ending with laren
$voertuig->query('*laren');

// apply query on the merk field
$voertuig->query(['merk']);

// search for cars by calling the search function:
$voertuig->search();