Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README for ver. 0.4.0 #21

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading