PHPackages                             ramlev/dom-onix-parser - 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. ramlev/dom-onix-parser

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

ramlev/dom-onix-parser
======================

An ONIX 3.0 Parser

1.0.0(3mo ago)012↓70.8%MITPHPPHP &gt;=8.3

Since Mar 23Pushed 2mo agoCompare

[ Source](https://github.com/ramlev/dom-onix-parser)[ Packagist](https://packagist.org/packages/ramlev/dom-onix-parser)[ RSS](/packages/ramlev-dom-onix-parser/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

PHP ONIX 3.0 Parser
===================

[](#php-onix-30-parser)

A PHP library for reading ONIX 3.0 files in both Short and Ref tag formats. Text elements in different formats and ONIX date formats are automatically parsed. Code list values are resolved to human-readable strings.

**This library is under active development. Most fields are detected and parsed, but some still need work.**

Requirements
------------

[](#requirements)

- PHP &gt;= 8.3
- Symfony Serializer ^7.4

Installation
------------

[](#installation)

```
composer require ramlev/dom-onix-parser

```

Usage
-----

[](#usage)

```
$parser = new \Dso\Onix\Parser();

/** @var \Dso\Onix\Message\Message */
$message = $parser->parseString(file_get_contents('sample.xml'));

/** @var \Dso\Onix\Product\Product[] */
$products = $message->getProducts();
```

Code Lists
----------

[](#code-lists)

All code lists from **issue 61** are included. Codes in the ONIX file are automatically resolved to their human-readable values.

```

    03

```

```
$type = $product->getNotificationType();

$type->getCode();   // "03"
$type->getValue();  // "Notification confirmed on publication"
(string) $type;     // "Notification confirmed on publication"
```

### Multi-Language Code Lists

[](#multi-language-code-lists)

Pass a language code to the parser constructor to get code list values in that language:

```
$parser = new \Dso\Onix\Parser('de');
```

LanguageCodeEnglish (default)`en`Spanish`es`German`de`French`fr`Italian`it`Norwegian`nb`Turkish`tr`> Code lists were scraped from the [EDITEUR website](https://ns.editeur.org/onix/en). Some translations may be incomplete or inaccurate — pull requests are welcome.

Text Content
------------

[](#text-content)

Text fields are returned as `Text` objects and support multiple ONIX text formats (plain, HTML, XHTML, XML):

```
$text = $textContent->getText();

(string) $text;     // raw content
$text->toPlain();   // strips HTML tags, converts  to newlines
$text->toHtml();    // returns HTML; wraps plain text in  tags
```

Dates
-----

[](#dates)

Date fields are returned as `Date` objects and support all ONIX date format codes (CodeList 55), including ranges, weeks, quarters and seasons:

```
$date = $publishingDate->getDate();

$date->format('Y-m-d');         // e.g. "2024-03-15"
$date->format('d. F Y');        // e.g. "15. March 2024"
```

Measurements
------------

[](#measurements)

```
$detail = $product->getDescriptiveDetail();

// Loop all measures
foreach ($detail->getMeasures() as $measure) {
    echo sprintf('%s: %s %s',
        (string) $measure->getMeasureType(),    // e.g. "Height"
        $measure->getMeasurement(),             // e.g. "210"
        (string) $measure->getMeasureUnitCode() // e.g. "Centimeters"
    );
}

// Shorthand helpers
$detail->getHeight();
$detail->getWidth();
$detail->getThickness();
$detail->getWeight();
```

Running Tests
-------------

[](#running-tests)

```
composer test

```

Built With
----------

[](#built-with)

- [Symfony Serializer](https://symfony.com/doc/current/components/serializer.html)

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance85

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

92d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/74152?v=4)[Hasse Ramlev Wilson](/maintainers/ramlev)[@ramlev](https://github.com/ramlev)

---

Top Contributors

[![chrisribal](https://avatars.githubusercontent.com/u/3721852?v=4)](https://github.com/chrisribal "chrisribal (14 commits)")[![conatus](https://avatars.githubusercontent.com/u/317734?v=4)](https://github.com/conatus "conatus (10 commits)")[![ramlev](https://avatars.githubusercontent.com/u/74152?v=4)](https://github.com/ramlev "ramlev (8 commits)")[![alexschwarz89](https://avatars.githubusercontent.com/u/7203493?v=4)](https://github.com/alexschwarz89 "alexschwarz89 (2 commits)")[![cleshams](https://avatars.githubusercontent.com/u/34002404?v=4)](https://github.com/cleshams "cleshams (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ramlev-dom-onix-parser/health.svg)

```
[![Health](https://phpackages.com/badges/ramlev-dom-onix-parser/health.svg)](https://phpackages.com/packages/ramlev-dom-onix-parser)
```

###  Alternatives

[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k50.1M314](/packages/api-platform-core)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[api-platform/symfony

Symfony API Platform integration

354.0M110](/packages/api-platform-symfony)[api-platform/serializer

API Platform core Serializer

244.3M71](/packages/api-platform-serializer)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

1237.8M120](/packages/web-auth-webauthn-lib)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

51090.8k2](/packages/web-auth-webauthn-framework)

PHPackages © 2026

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