Download the PHP package ottosmops/oai-pmh without Composer
On this page you can find all versions of the php package ottosmops/oai-pmh. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ottosmops/oai-pmh
More information about ottosmops/oai-pmh
Files in ottosmops/oai-pmh
Package oai-pmh
Short Description Laravel-native OAI-PMH 2.0 server: verb dispatching, resumption tokens, Blade views, pluggable repository contract.
License MIT
Informations about the package oai-pmh
ottosmops/oai-pmh
A Laravel-native OAI-PMH 2.0 server. Ships the protocol framework — verb dispatching, resumption tokens, Blade views, XML envelope — and leaves the domain-specific mapping to your repository implementations.
Implements every requirement of the
OAI-PMH 2.0 specification
including all eight error codes, deleted-record tombstones, set hierarchy,
date-granularity rules, and resumption-token pagination with
completeListSize + cursor attributes. XSD-conformance test suite
validates every response against the upstream schema.
Originally developed in collaboration with the Gosteli Archive – History of women's movements in Switzerland (University Library Bern; archive database at gosteli.anton.ch), within the Anton archive management system, and later extracted so that other archives can reuse the underlying protocol framework.
Requirements
- PHP 8.2+
- Laravel 10, 11, or 12
Installation
Publish the config (optional — sensible defaults ship in-package):
Publish the Blade views (optional — only if you need to customise the XML output, e.g. add a custom XSI schema on the root element):
Quickstart
1. Implement a repository
Repositories fetch records from your data source. The package handles the protocol (pagination, tokens, errors, XML) — you just return records.
2. Register the repository
In config/oai-pmh.php:
3. Register the route
In routes/web.php:
Or, if you want the package to register the default route for you:
4. Harvest
Configuration reference
| Key | Type | Default | Purpose |
|---|---|---|---|
repository_name |
string | null |
<repositoryName> in Identify |
admin_email |
string|string[] | null |
One or more <adminEmail> |
sample_identifier |
string|Closure | null |
Example identifier shown in the oai-identifier description |
granularity |
string | YYYY-MM-DDThh:mm:ssZ |
Date granularity per §3.3 |
deletedRecord |
string | no |
no | persistent | transient |
limit |
int | 50 |
ListRecords page size |
limit_identifier |
int | 200 |
ListIdentifiers page size (headers only) |
metadataFormats |
array | [] |
Keyed by metadataPrefix; each entry has repository, schema, namespace |
sets |
array | [] |
Each entry has spec, name, optional description |
friends |
array | [] |
Optional OAI-PMH friend repository base URLs |
earliestDatestamp |
?string | null |
Fallback when no repository can supply one |
Customising views
Run vendor:publish --tag=oai-pmh-views, then edit
resources/views/vendor/oai-pmh/*.blade.php. Views receive the
following data (full shape in the verb handlers under
src/Http/Controllers/Verbs/):
| View | Data |
|---|---|
identify.blade.php |
repositoryName, adminEmails, earliestDatestamp, deletedRecord, granularity, sampleIdentifier, friends |
error.blade.php |
errors (array of [code, message]) |
get-record.blade.php |
record (Record), metadataPrefix |
list-records.blade.php |
records, metadataPrefix, token, cursor, completeListSize |
list-identifiers.blade.php |
records, token, cursor, completeListSize |
list-metadata-formats.blade.php |
formats (array of MetadataPrefix) |
list-sets.blade.php |
sets (array from config) |
All views also receive $responseDate, $requestAttributes, $baseUrl.
Deleted records
To expose a deleted record per §2.5.1 (modes persistent / transient):
The view emits <header status="deleted"> with identifier + datestamp,
and no <metadata> element.
Testing your repository
The package ships a minimal in-memory fixture (tests/Fixtures/InMemoryRepository)
you can reuse in your own test suite to wire things up before writing
your real repository.
Real-world example
Anton's archive-management system uses this package with two repositories:
Anton\Services\Oai\OaiDcRepositoryserves unqualified Dublin CoreAnton\Services\Oai\OaiEadRepositoryserves pre-exported EAD files from disk
License
MIT
All versions of oai-pmh with dependencies
illuminate/support Version ^10.0 || ^11.0 || ^12.0
illuminate/http Version ^10.0 || ^11.0 || ^12.0
illuminate/view Version ^10.0 || ^11.0 || ^12.0
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0
nesbot/carbon Version ^2.0 || ^3.0