PHP code example of 3ft9 / dpla

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

    

3ft9 / dpla example snippets



$dpla = new \TFN\DPLA('your api key');

$res = $dpla->createSearchQuery()->forText('pizza')->withPaging(1, 10)->execute();

$res = $dpla->createSearchQuery()->withTitle('pizza')->withPaging(1, 10)->execute();

// Get the total number of documents that matched the search query.
$total_count = $res->getTotalCount();

// Get the page details that this results object represents.
$page = $res->getPageNumber();
$per_page = $res->getPerPage();

// Get an array of the documents in this results object.
$docs = $res->getDocuments();

$prev_page_res = $res->getPrevPage();
$next_page_res = $res->getNextPage();

$current_query = $res->getSearchQuery();
$prev_page_query = $res->getPrevPageSearchQuery();
$next_page_query = $res->getNextPageSearchQuery();