PHPackages                             manoj/toon-php-lite - 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. manoj/toon-php-lite

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

manoj/toon-php-lite
===================

Lite PHP implementation of TOON (Token-Oriented Object Notation)

0.4.0(7mo ago)1126MITPHPPHP &gt;=8.1CI passing

Since Nov 13Pushed 7mo agoCompare

[ Source](https://github.com/manojrammurthy/toon-php-lite)[ Packagist](https://packagist.org/packages/manoj/toon-php-lite)[ RSS](/packages/manoj-toon-php-lite/feed)WikiDiscussions main Synced 3w ago

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

[![PHP Version](https://camo.githubusercontent.com/138b5a1f19bb070beed29c5fb32fe089fd00df6ee87b744ec8fbe07d7885bb15/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253230382e32253230253743253230382e332d626c7565)](https://camo.githubusercontent.com/138b5a1f19bb070beed29c5fb32fe089fd00df6ee87b744ec8fbe07d7885bb15/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253230382e32253230253743253230382e332d626c7565)[![Code Style](https://camo.githubusercontent.com/5beafc293f0d1aba699b808c56e9889e59505c75185a86d4605202cc4e393a32/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d50535231322d677265656e)](https://camo.githubusercontent.com/5beafc293f0d1aba699b808c56e9889e59505c75185a86d4605202cc4e393a32/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d50535231322d677265656e)[![Static Analysis](https://camo.githubusercontent.com/b58071ce0a8e939f94786932f11084d4e542be0e467dbea63806c2ee92dee42c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d79656c6c6f77)](https://camo.githubusercontent.com/b58071ce0a8e939f94786932f11084d4e542be0e467dbea63806c2ee92dee42c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230382d79656c6c6f77)[![Coverage](https://camo.githubusercontent.com/75b440e6fa9d0acbcebae617e3e75f6359db48ccdcbdf4dafd428d5f6b081c1d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d3130302532352d627269676874677265656e)](https://camo.githubusercontent.com/75b440e6fa9d0acbcebae617e3e75f6359db48ccdcbdf4dafd428d5f6b081c1d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d3130302532352d627269676874677265656e)

🚀 TOON PHP Lite
===============

[](#-toon-php-lite)

**A lightweight, dependency-free PHP library for encoding &amp; decoding TOON (Token-Oriented Object Notation).**

[![Tests](https://github.com/manojrammurthy/toon-php-lite/actions/workflows/tests.yml/badge.svg)](https://github.com/manojrammurthy/toon-php-lite/actions/workflows/tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/3f35db14c2d10c080ab64d078b092c9029e42da04800f72c530ccb824533c5d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616e6f6a2f746f6f6e2d7068702d6c6974652e737667)](https://packagist.org/packages/manoj/toon-php-lite)[![License](https://camo.githubusercontent.com/da244fa84239e29b4e6ad3e06ceddaf305b9337a7d2bc4247e1e541ef78c9462/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d616e6f6a72616d6d75727468792f746f6f6e2d7068702d6c6974652e737667)](LICENSE)

**TOON** is a compact, human-readable, LLM-friendly data format — an alternative to JSON that uses indentation, lists, and tabular rows for intuitive structure.

This library provides a **lite encoder + decoder**, suitable for everyday PHP applications, config parsing, and AI-driven workflows.

---

✨ Features
==========

[](#-features)

### ▶ Encoding &amp; Decoding

[](#-encoding--decoding)

- Simple API: `Toon::encode()` / `Toon::decode()`
- Full support for:

    - Nested objects via indentation
    - Primitive arrays: `tags[3]: php,ai,iot`
    - List arrays:

        ```
        tags[2]:
          - php
          - ai

        ```
    - Tabular arrays (`key[n]{a,b,c}:`):

        ```
        items[2]{sku,qty,price}:
          A1,2,9.99
          B2,1,14.5

        ```

### ▶ New in v0.4.0

[](#-new-in-v040)

- **Triple-quoted multiline strings**

    ```
    bio: """
    I am Manoj.
    I love PHP.
    """

    ```
- **Minified TOON output** (fully valid, no indentation)

    ```
    (new EncodeOptions())->setMinify(true);
    ```
- **Complete test suite** + round-trip stability checks
- **PHPStan clean (level 8)**
- **Strict types everywhere**

### ▶ Other Features

[](#-other-features)

- Zero dependencies
- Detailed decode errors

    - row count mismatches
    - bad tabular rows
    - invalid indentation
- Comment support:

    - `# comment`
    - `// comment`
    - `id: 1   # inline`

Supports PHP **8.1 – 8.3**

---

📦 Installation
==============

[](#-installation)

### via Packagist

[](#via-packagist)

```
composer require manoj/toon-php-lite
```

### Development

[](#development)

```
git clone git@github.com:manojrammurthy/toon-php-lite.git
cd toon-php-lite
composer install
```

---

🚀 Quick Start
=============

[](#-quick-start)

```
