kraenzle-ritter/sipper
最新稳定版本:v1.1.0
Composer 安装命令:
composer require kraenzle-ritter/sipper
包简介
Deal with SIPs
README 文档
README
This small package is used to read and parse SIP (Submission Information Package) metadata files in the eCH-0160 ARELDA format. It provides easy access to documents, dossiers, files, and their relationships within the SIP structure.
Installation
You can install the package via composer:
composer require kraenzle-ritter/sipper
Usage
Basic Usage
use KraenzleRitter\Sipper\SipReader; $metadata = file_get_contents($file); $sipReader = new SipReader($metadata); // Access the raw XML $xml = $sipReader->xml; // Get all documents $documents = $sipReader->getDokumente(); // Get all dossiers $dossiers = $sipReader->getDossiers(); // Get first level dossiers only $firstLevelDossiers = $sipReader->getFirstLevelDossiers(); // Get document by file reference ID $document = $sipReader->getDokumentByDateiRef($dateiRef); // Get file information by reference ID $file = $sipReader->getDateiByDateiRef($dateiRef); // Get full path of a file by reference ID $path = $sipReader->getPathByDateiRef($dateiRef); // Get document title by filename $title = $sipReader->getDokumentTitelByFilename('example.pdf'); // Get parent identifier for a dossier $parentId = SipReader::getParentIdentifier($dossier, 'PREFIX_');
Example: Finding Documents by Filename
$sipReader = new SipReader($metadata); // Find the document title for a specific file $documentTitle = $sipReader->getDokumentTitelByFilename('report.pdf'); if (!empty($documentTitle)) { echo "Document title: " . $documentTitle; } else { echo "File not found in SIP"; }
Exception Handling
Some methods throw InvalidArgumentException when the requested element is not found:
try { $document = $sipReader->getDokumentByDateiRef('NONEXISTENT'); } catch (InvalidArgumentException $e) { echo "Document not found: " . $e->getMessage(); }
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-05