Skip to content

v1.0.0

Choose a tag to compare

@HelgeSverre HelgeSverre released this 27 Oct 14:09
· 54 commits to main since this release

Initial Stable Release

TOON (Token-Oriented Object Notation) is a compact data format for reducing token consumption when sending structured data to Large Language Models.

Installation

composer require helgesverre/toon

Example

use HelgeSverre\Toon\Toon;

echo Toon::encode([
    'items' => [
        ['sku' => 'A1', 'qty' => 2, 'price' => 9.99],
        ['sku' => 'B2', 'qty' => 1, 'price' => 14.5]
    ]
]);

Output:

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

Features

  • Support for primitive types (strings, numbers, booleans, null)
  • Objects with key-value pairs
  • Arrays in multiple formats (primitive, tabular, nested)
  • DateTime objects in ISO 8601 format
  • Intelligent string quoting
  • Configurable indentation and delimiters
  • 133 tests, 181 assertions

Documentation

Full changelog: https://github.com/HelgeSverre/toon-php/commits/v1.0.0