PHPackages                             slub/php-mods-reader - 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. slub/php-mods-reader

ActiveLibrary

slub/php-mods-reader
====================

Read MODS metadata into PHP objects that offer some convenient data extraction methods

v0.4.0(1y ago)416.7k—0%3[1 PRs](https://github.com/slub/php-mods-reader/pulls)GPL-3.0-or-laterPHPPHP &gt;=7.4

Since Mar 28Pushed 1y ago2 watchersCompare

[ Source](https://github.com/slub/php-mods-reader)[ Packagist](https://packagist.org/packages/slub/php-mods-reader)[ RSS](/packages/slub-php-mods-reader/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

MODS Metadata Reader for PHP
============================

[](#mods-metadata-reader-for-php)

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.

[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
-----

[](#usage)

- Create new instance of reader and pass the MODS XML as SimpleXMLElement.
- Get needed elements or attributes.
- Example (omitting empty and null checks):

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

// get all titleInfo elements
$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"]');

// 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();

// 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:
------

[](#todos)

- Add missing reading of metadata
- Add alternative functions (use params instead of string queries) for reading of metadata
- Add logging
- Add test coverage

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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 ~27 days

Total

4

Last Release

642d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d678dc279d542eb86b8b2c6aa8b10f74115b2dfcf143bd10e20b4e746764470?d=identicon)[slub](/maintainers/slub)

---

Top Contributors

[![beatrycze-volk](https://avatars.githubusercontent.com/u/9614459?v=4)](https://github.com/beatrycze-volk "beatrycze-volk (79 commits)")

---

Tags

modsmods-reader

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slub-php-mods-reader/health.svg)

```
[![Health](https://phpackages.com/badges/slub-php-mods-reader/health.svg)](https://phpackages.com/packages/slub-php-mods-reader)
```

PHPackages © 2026

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