PHP code example of bclibraries / primo-client

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

    

bclibraries / primo-client example snippets




$config = [
    'apikey' => 'l7xx38c6a1a3043974262e81a81fb7475ba9',
    'gateway' => 'https://api-na.hosted.exlibrisgroup.com',
    'vid' => 'my_vid',
    'tab' => 'the_tab',
    'scope' => 'mylib'
];
$primo = \BCLib\PrimoClient\PrimoClient::build(
                                                $config['gateway'],
                                                $config['apikey'], 
                                                $config['tab'],
                                                $config['vid'],
                                                $config['scope']
                                               );
$response = $primo->search('otters');

$request = $primo->getSearchRequest();

$contains_manchurian_candidate = new \BCLib\PrimoClient\Query('any','contains','manchurian candidate');
$contains_demme = new \BCLib\PrimoClient\Query('creator','contains','demme');

$is_video = new \BCLib\PrimoClient\QueryFacet('facet_rtype','exact','video');

$request->addQuery($contains_manchurian_candidate)
    ->addQuery($contains_demme, 'NOT')
    ->

echo "{$response->json->info->total} total results\n";
foreach ($response->json->docs as $doc) {
    echo "{$doc->pnx->display->title[0]}\n";
}

echo "{$response->total} total results\n";
foreach ($response->docs as $doc) {
    echo "{$doc->title}\n";
}