1. Go to this page and download the library: Download kraenzle-ritter/sipper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kraenzle-ritter / sipper example snippets
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_');
$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";
}