PHPackages                             brianseitel/ook - 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. brianseitel/ook

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

brianseitel/ook
===============

A package that transforms XML/JSON documents from one standard to another

16161PHP

Since Apr 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/brianseitel/ook)[ Packagist](https://packagist.org/packages/brianseitel/ook)[ RSS](/packages/brianseitel-ook/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Ook
===

[](#ook)

A translator for XML/JSON files using a YAML or JSON configuration.

### What is "Ook"?

[](#what-is-ook)

In the *Discworld* series by Larry Niven, the Librarian is a wizard turned into an orangutan early in the series. He understands Morporkian (English) perfectly well, but always speaks in orangutan, using words like "Ook" and "Eek". Most human characters have little trouble understanding this, but every now and again someone unfamiliar with the Librarian meets him and cannot quite figure out what that particular "Ook" meant. The Librarian tried to address this issue by writing an Orangutan-Morpokian dictionary, but has not progressed beyond "Ook" yet.

### Oh, I see.

[](#oh-i-see)

Yeah, pretty funny, right?

Quick Start
-----------

[](#quick-start)

### Define a configuration

[](#define-a-configuration)

Ook utilizes the "dot" notation when defining rules for translating between arrays. Here's a quick example of what dot notation is:

```
$array = ['items' => [
    'item' => [
        ['name' => 'computer', 'price' => 1000],
        ['name' => 'monitor', 'price' => 150]
    ]
];

Arr::get('items.item.0.price') // 1000
```

We'll use the same thing to define a ruleset for XML:

#### sample.xml

[](#samplexml)

```

        computer
        1000

        monitor
        150

```

Ook will convert this to an array with a key of `item.price`. Let's imagine we want to translate this from `item.price` to `inventory.item.price`

#### config.yaml

[](#configyaml)

```
inventory.item.*.name: items.item.*.name
inventory.item.*.price: items.item.*.price
```

To translate it, we simply run:

```
$librarian = new Ook\Librarian('sample.xml', 'config.yaml');
$output = $librarian->transform();
```

This will return:

```
Array
(
    [inventory] => Array
        (
            [item] => Array
                (
                    [0] => Array
                        (
                            [name] => computer
                            [price] => 1000
                        )

                    [1] => Array
                        (
                            [name] => monitor
                            [price] => 150
                        )

                )

        )

)

```

### Additional Details

[](#additional-details)

Check out the `/examples` directory for more samples.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/503048?v=4)[Brian Seitel](/maintainers/brianseitel)[@brianseitel](https://github.com/brianseitel)

---

Top Contributors

[![brianseitel](https://avatars.githubusercontent.com/u/503048?v=4)](https://github.com/brianseitel "brianseitel (1 commits)")

### Embed Badge

![Health badge](/badges/brianseitel-ook/health.svg)

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

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

46143.1k6](/packages/jstewmc-rtf)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

112.9k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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