PHPackages                             scriptotek/simplemarcparser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. scriptotek/simplemarcparser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

scriptotek/simplemarcparser
===========================

A simple MARC21/XML parser

v0.9.1(9y ago)74812[2 issues](https://github.com/scriptotek/simplemarcparser/issues)MITPHPPHP &gt;=5.6

Since Nov 9Pushed 7y ago4 watchersCompare

[ Source](https://github.com/scriptotek/simplemarcparser)[ Packagist](https://packagist.org/packages/scriptotek/simplemarcparser)[ RSS](/packages/scriptotek-simplemarcparser/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (6)Versions (15)Used By (0)

SimpleMarcParser
================

[](#simplemarcparser)

[![Build Status](https://camo.githubusercontent.com/b2360a1da4ed1b98a8cdccd8876d685acb3048b4f1a26633bfd2606a0b3a1478/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f7363726970746f74656b2f73696d706c656d6172637061727365722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/scriptotek/simplemarcparser)[![Coverage Status](https://camo.githubusercontent.com/6523eb7fd78506f259a8f1d32484f2f4586794ce51a213765f358afcf5e88041/687474703a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7363726970746f74656b2f73696d706c656d6172637061727365722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/scriptotek/simplemarcparser?branch=master)[![Code Quality](https://camo.githubusercontent.com/8f866f7a1fd16f2074c511e72add95957f89c4e6a568a5546c6aec69a77e76d8/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7363726970746f74656b2f73696d706c656d6172637061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/scriptotek/simplemarcparser/?branch=master)[![StyleCI](https://camo.githubusercontent.com/1138c3ee7059d3ab48a56b4f5c4e441c52b91cac74d043c99b603bed842fef90/68747470733a2f2f7374796c6563692e696f2f7265706f732f31343234363235332f736869656c64)](https://styleci.io/repos/14246253)[![Latest Stable Version](https://camo.githubusercontent.com/a6d73d8d20edfa49b12fdb76cce94544377154b2b7a94aaf5a48e16a17b8e9dc/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7363726970746f74656b2f73696d706c656d6172637061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/scriptotek/simplemarcparser)[![Total Downloads](https://camo.githubusercontent.com/869c41c5ba36152f182e44d9273fb3b464a42043eca974a00e5f2eeb0a78d67a/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7363726970746f74656b2f73696d706c656d6172637061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/scriptotek/simplemarcparser)

`SimpleMarcParser` is currently a minimal MARC21/XML parser for use with `QuiteSimpleXMLElement`, with support for the MARC21 Bibliographic, Authority and Holdings formats.

**Note:** This project is not actively developed anymore, but I will still process issues. The aim of this project was to produce “simple” JSON representations of MARC21 records. I'm now working on [php-marc](https://github.com/scriptotek/php-marc), a wrapper for File\_MARC.

Example:
--------

[](#example)

```
require_once('vendor/autoload.php');

use Danmichaelo\QuiteSimpleXMLElement\QuiteSimpleXMLElement,
    Scriptotek\SimpleMarcParser\Parser;

$data = file_get_contents('http://sru.bibsys.no/search/biblio?' . http_build_query(array(
	'version' => '1.2',
	'operation' => 'searchRetrieve',
	'recordSchema' => 'marcxchange',
	'query' => 'bs.isbn="0-521-43291-x"'
)));

$doc = new QuiteSimpleXMLElement($data);
$doc->registerXPathNamespaces(array(
        'srw' => 'http://www.loc.gov/zing/srw/',
        'marc' => 'http://www.loc.gov/MARC21/slim',
        'd' => 'http://www.loc.gov/zing/srw/diagnostic/'
    ));

$parser = new Parser();

$record = $parser->parse($doc->first('/srw:searchRetrieveResponse/srw:records/srw:record/srw:recordData/marc:record'));

print $record->title;

foreach ($record->subjects as $subject) {
	print $subject['term'] . '(' . $subject['system'] . ')';
}
```

Transformation/normalization
============================

[](#transformationnormalization)

This parser is aimed at producing machine actionable output, and does some non-reversible transformations to achieve this. Transformation rules expect AACR2-like records, and are tested mainly against the Norwegian version of AACR2 (*Norske katalogregler*), but might work well with other editions as well.

Examples:

- `title` is a combination of 300 $a and $b, separated by `:`.
- `year` is an integer extracted from 260 $c by extracting the first four digit integer found (`c2013` → `2013`, `2009 [i.e. 2008]` → `2009` (this might be a bit rough…))
- `pages` is an integer extracted from 300 $a. The raw value, useful for e.g. non-verbal content, is stored in `extent`
- `creators[].name` are transformed from ', ' to ' '

Form and material
=================

[](#form-and-material)

Form and material is encoded in the leader and in control fields 006, 007 and 008. Encoding this information in a format that makes sense is a *work-in-progress*.

Electronic and printed material is currently distinguished using the boolean valued `electronic` key.

Printed book:

```
{
	"material": "book",
	"electronic": false
}
```

Electronic book:

```
{
	"material": "book",
	"electronic": true
}
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance14

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.8% 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 ~95 days

Recently: every ~180 days

Total

15

Last Release

3288d ago

PHP version history (3 changes)v0.6.0PHP &gt;=5.3

v0.8.0PHP &gt;=5.4

v0.9.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/87db1d80793d2adbeca18997c33acbb5cf1dec75ccc5c19f147d666dfbf2e990?d=identicon)[danmichaelo](/maintainers/danmichaelo)

---

Top Contributors

[![danmichaelo](https://avatars.githubusercontent.com/u/434495?v=4)](https://github.com/danmichaelo "danmichaelo (167 commits)")[![agnarodegard](https://avatars.githubusercontent.com/u/5804387?v=4)](https://github.com/agnarodegard "agnarodegard (1 commits)")[![eldorplus](https://avatars.githubusercontent.com/u/1168143?v=4)](https://github.com/eldorplus "eldorplus (1 commits)")

---

Tags

marc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/scriptotek-simplemarcparser/health.svg)

```
[![Health](https://phpackages.com/badges/scriptotek-simplemarcparser/health.svg)](https://phpackages.com/packages/scriptotek-simplemarcparser)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k16.6M147](/packages/spatie-laravel-sitemap)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k9.0M69](/packages/spatie-laravel-responsecache)

PHPackages © 2026

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