承接 slub/php-mods-reader 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

slub/php-mods-reader

最新稳定版本:v0.4.0

Composer 安装命令:

composer require slub/php-mods-reader

包简介

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

README 文档

README

The library is designed to facilitate the parsing and interpretation of Metadata Object Description Schema (MODS) metadata within PHP applications.

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

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

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

统计信息

  • 总下载量: 13.26k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固