PHPackages                             scriptotek/oai-pmh-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. scriptotek/oai-pmh-client

Abandoned → [caseyamcl/phpoaipmh](/?search=caseyamcl%2Fphpoaipmh)ArchivedLibrary[API Development](/categories/api)

scriptotek/oai-pmh-client
=========================

Package for harvesting data from OAI-PMH repositories

v0.7.1(9y ago)25072MITPHPPHP &gt;=5.5

Since Dec 15Pushed 9y ago3 watchersCompare

[ Source](https://github.com/scriptotek/php-oai-pmh-client)[ Packagist](https://packagist.org/packages/scriptotek/oai-pmh-client)[ Docs](https://github.com/scriptotek/php-oai-pmh-client)[ RSS](/packages/scriptotek-oai-pmh-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (10)Used By (0)

[![Build Status](https://camo.githubusercontent.com/92bcf0a3132cc0209b4a1fc549494314892d9008193c7a9bce4d5055004d99b4/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f7363726970746f74656b2f7068702d6f61692d706d682d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/scriptotek/php-oai-pmh-client)[![Coverage](https://camo.githubusercontent.com/f050919b36c2f36ad0dcfa95744f5f4d8bd05067d3399dfadda70b15406bacd9/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7363726970746f74656b2f7068702d6f61692d706d682d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/scriptotek/php-oai-pmh-client)[![Code Quality](https://camo.githubusercontent.com/9442737d0c3978a70b43e938e9db7a45488bb350f809dc538674957a235c1d5d/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7363726970746f74656b2f7068702d6f61692d706d682d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/scriptotek/php-oai-pmh-client/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/73c5fc3d4497883be78307f9517e8cac47bb2cffe003055af3ce6f2ee9b2593a/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7363726970746f74656b2f6f61692d706d682d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/scriptotek/oai-pmh-client)[![Total Downloads](https://camo.githubusercontent.com/9157d759cc253b3abf2520949a9ebdf556c8dacca3363049d800016a94dc9b51/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7363726970746f74656b2f6f61692d706d682d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/scriptotek/oai-pmh-client)

**Note**: This package is abandoned. I recommend using the [caseyamcl/phpoaipmh](https://github.com/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.

php-oai-pmh-client
------------------

[](#php-oai-pmh-client)

Simple PHP client package for fetching data from an OAI-PMH server, using the [Guzzle HTTP client](http://guzzlephp.org/). The returned data is parsed by [QuiteSimpleXMLElement](//github.com/danmichaelo/quitesimplexmlelement).

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

### Install using Composer

[](#install-using-composer)

```
composer require scriptotek/oai-pmh-client

```

### Example

[](#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

[](#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

[](#iterating-over-a-record-set)

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

### Events

[](#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)

API documentation can be generated using e.g. [Sami](https://github.com/fabpot/sami), which is included in the dev requirements of `composer.json`.

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

```

You can view it at [scriptotek.github.io/php-oai-pmh-client](//scriptotek.github.io/php-oai-pmh-client/)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~89 days

Recently: every ~35 days

Total

9

Last Release

3459d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.3

v0.7.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/87db1d80793d2adbeca18997c33acbb5cf1dec75ccc5c19f147d666dfbf2e990?d=identicon)[danmichaelo](/maintainers/danmichaelo)

---

Top Contributors

[![danmichaelo](https://avatars.githubusercontent.com/u/434495?v=4)](https://github.com/danmichaelo "danmichaelo (45 commits)")

---

Tags

OAI-PMH

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/scriptotek-oai-pmh-client/health.svg)

```
[![Health](https://phpackages.com/badges/scriptotek-oai-pmh-client/health.svg)](https://phpackages.com/packages/scriptotek-oai-pmh-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
