PHPackages                             mateuszkardas/toon - 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. mateuszkardas/toon

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

mateuszkardas/toon
==================

PHP implementation of Token-Oriented Object Notation (TOON) - A compact, human-readable serialization format designed for LLM input

v0.1.0(6mo ago)929MITPHPPHP &gt;=8.1

Since Nov 3Pushed 6mo agoCompare

[ Source](https://github.com/mateuszkardas/toon-php)[ Packagist](https://packagist.org/packages/mateuszkardas/toon)[ Docs](https://github.com/mateuszkardas/toon-php)[ RSS](/packages/mateuszkardas-toon/feed)WikiDiscussions main Synced 1mo ago

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

TOON (Token-Oriented Object Notation) - PHP Implementation
==========================================================

[](#toon-token-oriented-object-notation---php-implementation)

[![PHP Version](https://camo.githubusercontent.com/8e58b490725ac49cc8e463c473173681b324c9d92d7854275a785db013ca3de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870)](https://www.php.net/)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](./LICENSE)

> **Note:** This is a PHP implementation based on the original TOON format specification and reference implementations from [toon-format/toon](https://github.com/toon-format/toon)

PHP implementation of **Token-Oriented Object Notation (TOON)**, a compact, human-readable serialization format designed for passing structured data to Large Language Models with significantly reduced token usage.

TOON is intended for LLM input, not output. It's particularly efficient for **uniform arrays of objects** – multiple fields per row, same structure across items.

Features
--------

[](#features)

- 💸 **Token-efficient:** typically 30–60% fewer tokens than JSON
- 🤿 **LLM-friendly guardrails:** explicit lengths and fields enable validation
- 🍱 **Minimal syntax:** removes redundant punctuation (braces, brackets, most quotes)
- 📐 **Indentation-based structure:** like YAML, uses whitespace instead of braces
- 🧺 **Tabular arrays:** declare keys once, stream data as rows
- ✅ **Full compatibility:** Implements the [TOON v1.3 specification](https://github.com/toon-format/spec)

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

[](#installation)

Install via Composer:

```
composer require mateuszkardas/toon
```

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

[](#quick-start)

```
