← Projects

Laravel TOON

★ 148 v2.0.0

The TOON format for Laravel. The same data as JSON, in far fewer tokens.

composer require mischasigtermans/laravel-toon

What it does

  • Tables instead of repeated keys

    An array of uniform objects becomes a table: field names once in the header, one row per record. The keys are written once, so the saving over JSON grows with every row.

  • Nested objects stay in the table

    Nested objects that share one shape become nested field groups, like {id,author{name,email}}, at any depth. Objects of uniform objects collapse into keyed tables. Arrays whose objects differ in shape fall back to list form.

  • Built to the spec

    Implements the TOON specification and runs every fixture of its official test suite. Decoding gives back the original structure, with ints, floats, booleans and nulls intact.

  • Laravel-shaped

    Toon::encode() and Toon::decode(), toon_encode() and toon_decode() helpers, a toToon macro on collections and a toToon method on Eloquent models.

  • Knobs for fewer tokens

    Omit nulls, empty strings or false values, drop keys like timestamps, alias long key names, truncate strings and cap float precision. Toon::diff() measures the saving in characters before you commit.

Install Laravel TOON.

Hi, I'm Mischa. I've been shipping products and building ventures for over a decade. First exit at 25, second at 30. Now Partner & CPO at Ryde Ventures, an AI venture studio in Amsterdam. Currently shipping Stagent, TAP and Steddle. I write about what I learn along the way. More about me.

You might also enjoy: How working out 5 times a week changed my life.

← Projects