2017 © Pedro PelĂĄez
 

library oai-pmh-client

Package for harvesting data from OAI-PMH repositories

image

scriptotek/oai-pmh-client

Package for harvesting data from OAI-PMH repositories

  • Sunday, December 11, 2016
  • by danmichaelo
  • Repository
  • 4 Watchers
  • 2 Stars
  • 481 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 10 Versions
  • 1 % Grown

The README.md

Build Status Coverage Code Quality Latest Stable Version Total Downloads, (*1)

Note: This package is abandoned. I recommend using the caseyamcl/phpoaipmh package instead. It has an almost identical interface, great code quality and more contributors, so I see no reason to continue maintaining this package., (*2)

php-oai-pmh-client

Simple PHP client package for fetching data from an OAI-PMH server, using the Guzzle HTTP client. The returned data is parsed by QuiteSimpleXMLElement., (*3)

On network problems, the client will retry a configurable number of times, emitting a request.error event each time, before finally throwing a ConnectionError., (*4)

Install using Composer

composer require scriptotek/oai-pmh-client

Example

require_once('vendor/autoload.php');
use Scriptotek\OaiPmh\Client as OaiPmhClient;

$url = 'http://oai.bibsys.no/repository';

$client = new OaiPmhClient($url, array(
    'schema' => 'marcxchange',
    'user-agent' => 'MyTool/0.1',
    'max-retries' => 10,
    'sleep-time-on-error' => 30,
));

Fetching a single record

try {
    $record = $client->record('oai:bibsys.no:biblio:113889372');
} catch (Scriptotek\OaiPmh\ConnectionError $e) {
    echo $e->getMsg();
    die;
} catch (Scriptotek\OaiPmh\BadRequestError $e) {
    echo 'Bad request: ' . $e->getMsg() . "\n";
    die;
}

echo $record->identifier . "\n";
echo $record->datestamp . "\n";
echo $record->data->asXML() . "\n";

Iterating over a record set

foreach ($client->records('') as $record) {
    echo $record->identifier . "\n";
    echo $record->datestamp . "\n";
}

Events

$client->on('request.start', function($verb) {
    print "Starting " . $verb . " request\n";
});
$client->on('request.error', function($err) {
    print "Non-fatal error: " . $err . "\n";
});
$client->on('request.complete', function($verb) {
    print "Completed " . $verb . " request\n";
});

API documentation

API documentation can be generated using e.g. Sami, which is included in the dev requirements of composer.json., (*5)

php vendor/bin/sami.php update sami.config.php -v

You can view it at scriptotek.github.io/php-oai-pmh-client, (*6)

The Versions

11/12 2016

dev-master

9999999-dev https://github.com/scriptotek/php-oai-pmh-client

Package for harvesting data from OAI-PMH repositories

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

oai-pmh

27/11 2016

v0.7.1

0.7.1.0 https://github.com/scriptotek/php-oai-pmh-client

Package for harvesting data from OAI-PMH repositories

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

oai-pmh

21/08 2016

v0.7.0

0.7.0.0 https://github.com/scriptotek/php-oai-pmh-client

Package for harvesting data from OAI-PMH repositories

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

oai-pmh

12/07 2016
11/07 2016
10/07 2016
15/03 2015
03/02 2015

v0.2.1

0.2.1.0 http://github.com/scriptotek/oai-client

Package for harvesting data from OAI-PMH repositories

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

oai-pmh

21/12 2014

v0.2.0

0.2.0.0 http://github.com/scriptotek/oai-client

Package for harvesting data from OAI-PMH repositories

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

oai-pmh

15/12 2014

v0.1.0

0.1.0.0 http://github.com/scriptotek/oai-client

Package for harvesting data from OAI-PMH repositories

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dan Michael O. Heggø

oai-pmh