Skip to content

Commit

Permalink
Merge pull request #21 from beatrycze-volk/prepare-release
Browse files Browse the repository at this point in the history
Update README for ver. 0.4.0
  • Loading branch information
beatrycze-volk authored Jun 17, 2024
2 parents 4dde62f + 0b129fa commit f12ece9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ The library requires at least PHP 7.4.
$modsReader = new ModsReader($this->xml);

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

// get first titleInfo element
$firstTitleInfo = $modsReader->getFirstTitleInfo();

// get first titleInfo element
$lastTitleInfo = $modsReader->getLastTitleInfo();

// get name elements which match to give string query
$authors = $modsReader->getNames('[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]');
Expand All @@ -29,6 +35,20 @@ $identifier = $authors[0]->getNameIdentifier('[@type="orcid"]');

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

// get 'type' attribute of element
$type = $identifier->getType();

// get child elements of element
$places = [];
$originInfos = $this->modsReader->getOriginInfos('[not(./mods:edition="[Electronic ed.]")]');
foreach ($originInfos as $originInfo) {
foreach ($originInfo->getPlaces() as $place) {
foreach ($place->getPlaceTerms() as $placeTerm) {
$places[] = $placeTerm->getValue();
}
}
}
```

## TODOs:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "slub/php-mods-reader",
"description": "Read MODS metadata into PHP objects that offer some convenient data extraction methods",
"type": "library",
"readme": "README.md",
"keywords": [
"mods",
"mods-reader"
Expand Down

0 comments on commit f12ece9

Please sign in to comment.