PHP code example of simplyadmire / koop

1. Go to this page and download the library: Download simplyadmire/koop 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/ */

    

simplyadmire / koop example snippets


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

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

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