Uitvragen Officiële Publicaties DROP / GVOP Koop

1.0.0 2022-10-19 12:28 UTC

This package is auto-updated.

Last update: 2024-09-19 16:31:49 UTC


README

PHP 客户端用于 Koop 出版物 API。允许执行组合查询,并返回可迭代的对象。

目前只返回一个简单的出版物对象,包含标题、发布日期和原始 URL。但这非常适合指向 officielebekendmakingen.nl 官方源的网站搜索客户端。

查询结果将获取单个文档

官方 API 文档可在 http://koop.overheid.nl/producten/gvop/documentatie 找到

代码示例

找到 Barneveld 的最新 10 项(默认限制)条目

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

找到 Barneveld 或 Ede 的最新 10 项条目

    $query
        ->matching(
            $query->logicalOr(
                $query->exactMatch('creator', 'Barneveld'),
                $query->exactMatch('creator', 'Ede')
            )
        );

找到 Barneveld 或 Ede 发布的关于“paspoort”的最多 50 项条目,其中

  • Barneveld 自 2014 年 1 月 1 日起发布
  • Ede 自 2015 年 1 月 1 日起发布
    $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')
                )
            )
        );

遍历结果

    ...
    $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;
    }