simplyadmire / koop
Uitvragen Officiƫle Publicaties DROP / GVOP Koop
Installs: 22 803
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=7.1.0
- beberlei/assert: ^2.4
- guzzlehttp/guzzle: ^7.4
README
PHP Client for the Koop publications API. Allows doing combined queries and returns an iteratable result object.
Currently only a simple publication object with a title, publication date and original url is returned. But this is perfectly suitable for a website search client pointing to the official source on officielebekendmakingen.nl.
The query result will fetch a single document
Official API document can be found at http://koop.overheid.nl/producten/gvop/documentatie
Code examples
Find the latest 10 (default limit) items for Barneveld
$client = new \SimplyAdmire\Koop\Client( new \SimplyAdmire\Koop\Configuration() ); $query = new \SimplyAdmire\Koop\Search\Query(); $query ->matching( $query->exactMatch('creator', 'Barneveld') ); $result = $client->execute($query);
Find the latest 10 items for either Barneveld or Ede
$query ->matching( $query->logicalOr( $query->exactMatch('creator', 'Barneveld'), $query->exactMatch('creator', 'Ede') ) );
Find max 50 items about the term 'paspoort' published by Barneveld or Ede where:
- Barneveld published since 01-01-2014
- Ede published since 01-01-2015
$query ->setLimit(50) ->matching( $query->logicalOr( $query->logicalAnd( $query->exactMatch('creator', 'Barneveld'), $query->since(new \DateTime('2014-01-01')), $query->fullText('paspoort') ), $query->logicalAnd( $query->exactMatch('creator', 'Ede'), $query->since(new \DateTime('2015-01-01')), $query->fullText('paspoort') ) ) );
Iterating over the resut:
... $result = $client->execute($query); /** @var \SimplyAdmire\Koop\Model\Publication $publication */ foreach ($result as $publication) { echo $publication->getPublicationDate()->format('d-m-Y') . ' ' . $publication->getTitle() . PHP_EOL; }