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 2mo ago

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 27% 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://www.gravatar.com/avatar/86c7612e3fe68850001b6bdb41a1a033e9b1716237d179196fb0986983e7dc8f?d=identicon)[brianseitel](/maintainers/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

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[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)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

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

PHPackages © 2026

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