1. Go to this page and download the library: Download mirays/marc 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/ */
mirays / marc example snippets
foreach (\MirayS\Marc\Marc::books('dnb_all_dnbmarc.1.mrc.gz') as $book) {
echo implode(',', $book->isbn13s()), ' ', $book->title(), PHP_EOL;
}
\MirayS\Marc\Marc::read('oai-page.xml'); // records instead of shortcuts
\MirayS\Marc\Marc::readString($payload); // same detection over a string
\MirayS\Marc\Marc::detect('dump.ndjson'); // Format::MarcJson
$xml = (new \MirayS\Marc\Writer\MarcXmlWriter())->write($record);
$json = (new \MirayS\Marc\Writer\MarcJsonWriter())->write($record);
$binary = (new \MirayS\Marc\Writer\Iso2709Writer())->write($record);
$title = $record->getDataField('245');
$record->getAlternateGraphics($title); // the 880 fields holding the original script
$record->getLinkedField($alternate); // and back to 245
$record->getScriptPairs(); // every linked pair in the record
$record->getUnlinkedAlternateGraphics(); // 880s with occurrence 00
$alternate->getLinkage()?->script; // 'Cyrl'
$alternate->getLinkage()?->isRightToLeft();
Bibliographic::of($record)->titleOriginalScript();