PHPackages                             hebis/picareader - 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. hebis/picareader

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

hebis/picareader
================

Classes for reading Pica+ records encoded in Pica, PicaXML and PicaPlain

v1.1.0(9y ago)04.9k1GPL-3.0+PHP

Since May 23Pushed 2y ago2 watchersCompare

[ Source](https://github.com/HeBIS-VZ/PicaReader)[ Packagist](https://packagist.org/packages/hebis/picareader)[ RSS](/packages/hebis-picareader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

PicaReader – Classes for reading Pica+ records
==============================================

[](#picareader--classes-for-reading-pica-records)

About
=====

[](#about)

PicaReader provides classes for reading Pica+ records encoded in PicaXML and PicaPlain.

PicaReader is copyright (c) 2012-2016 by Herzog August Bibliothek Wolfenbüttel and released under the terms of the GNU General Public License v3.

Installation
============

[](#installation)

You can install PicaReader via Composer.

```
composer require hab/picareader
```

Usage
=====

[](#usage)

All readers adhere to the same interface. You open the reader with a string of input data by calling `Reader::open()` and can call `Reader::read()` to read the next record in the input data. If the input does not contain (anymore) records `Reader::read()` returns `FALSE`. Otherwise it returns either a record object created with PicaRecord’s `Record::factory()` function.

```
$reader = new \HAB\Pica\Reader\PicaXmlReader()
$reader->open(file_get_contents('http://unapi.gbv.de?id=opac-de-23:ppn:635012286&format=picaxml'));
$record = $reader->read();
$reader->close();
```

To filter out records or fields you can attach a filter to the reader via `Reader::setFilter()`. A filter is any valid PHP callback that takes an associative array representing the record as argument and returns a possibly modified array or `FALSE` if the entire record should be skipped.

The array representation of a record is defined as follows:

```
RECORD   := array('fields' => array(FIELD, …))
FIELD    := array('tag' => TAG, 'occurrence' => OCCURRENCE, 'subfields' => array(SUBFIELD, …))
SUBFIELD := array('code' => CODE, 'value' => VALUE)
```

Where `TAG`, `OCCURRENCE`, `CODE`, and `VALUE` are the respective properties of a Pica+ field or subfield.

For example, if your source delivers malformed PicaXML records like so:

```

    0001:14-09-10

  …

```

You can attach a filter function to remove these fields with an invalid tag:

```
$reader = new PicaXmlReader();
$reader->setFilter(function (array $r) {
    return array('fields' => array_filter($r['fields'],
                                          function (array $f) {
                                            return isset($f['tag']) && \HAB\Pica\Record\Field::isValidFieldTag($f['tag']);
                                          }));
  });
$record = $reader->read(…);
$reader->close();
```

Acknowledgements
================

[](#acknowledgements)

Large parts of this package would not have been possible without studying the source of [Pica::Record](http://search.cpan.org/dist/PICA-Record/), an open source Perl library for handling Pica+ records by Jakob Voß, and the practical knowledge of our library’s catalogers.

Footnotes
=========

[](#footnotes)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~351 days

Total

2

Last Release

3587d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/342d9b9237774ad552416dd2853b54f586e6293f13f9100c757b06a0454ce002?d=identicon)[bsunckel](/maintainers/bsunckel)

![](https://www.gravatar.com/avatar/3a2f684ee6ac437056b2c728224947bafe3402f54f5337595d06dad09b8701d2?d=identicon)[dlahm](/maintainers/dlahm)

---

Top Contributors

[![dmj](https://avatars.githubusercontent.com/u/58969?v=4)](https://github.com/dmj "dmj (4 commits)")[![bsunckel](https://avatars.githubusercontent.com/u/18614616?v=4)](https://github.com/bsunckel "bsunckel (2 commits)")[![dlahm](https://avatars.githubusercontent.com/u/150943953?v=4)](https://github.com/dlahm "dlahm (2 commits)")

---

Tags

hds

### Embed Badge

![Health badge](/badges/hebis-picareader/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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