Skip to content

Commit

Permalink
Update README file
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrycze-volk committed Apr 9, 2024
1 parent 8355ee4 commit afef5b6
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
# MODS Metadata Reader for PHP

Read [MODS](https://www.loc.gov/standards/mods/) XML into PHP objects that offer some convenient data extraction methods.
The library is designed to facilitate the parsing and interpretation of Metadata Object Description Schema ([MODS](https://www.loc.gov/standards/mods/)) metadata within PHP applications.

Requires at least PHP 7.4.
[MODS](https://www.loc.gov/standards/mods/) is a widely used metadata standard for describing digital resources such as electronic texts, images, and multimedia. It provides a flexible framework for describing various aspects of digital resources, including bibliographic information, administrative metadata, and structural metadata.

It provides developers with a set of tools and functions to easily extract, manipulate, and utilize MODS metadata within their PHP applications. It enables users to parse MODS XML documents, extract metadata elements, and querying metadata.

The library requires at least PHP 7.4.

## Usage

* Create new instance of reader and pass the MODS XML as SimpleXMLElement.
* Get needed elements or attributes.

* Example (omitting empty and null checks):

```php
$modsReader = new ModsReader($this->xml);

// get all titleInfo elements
$authors = $modsReader->getTitleInfos();

// get name elements which match to give string query
$authors = $modsReader->getNames('[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]');

// get nameIdentifier for first name element if its type attribute is equal to 'orcid'
$identifier = $authors[0]->getNameIdentifier('[@type="orcid"]');

// get string value of element
$value = $identifier->getValue();
```

## TODOs:

* Add missing reading for metadata (currently only the reading of top-level elements is implemented)
* Add missing reading of metadata
* Add alternative functions (use params instead of string queries) for reading of metadata
* Add test coverage

0 comments on commit afef5b6

Please sign in to comment.