{"repo":"mischasigtermans/laravel-toon","free":true,"listed":false,"github":"https://github.com/mischasigtermans/laravel-toon","clone":"git clone https://github.com/mischasigtermans/laravel-toon.git","description":"TOON encoding for Laravel. Encode data for AI/LLMs with ~50% fewer tokens than JSON.","language":"PHP","stars":146,"topics":["ai","json-alternative","laravel","llm","mcp","token-optimization","token-optimizer","toon"],"license":"MIT","category":"ai-agents","readme_excerpt":"Laravel TOON The most complete TOON implementation for Laravel, and the only one with full TOON v3.0 specification compliance. Listed as official Laravel implementation. TOON (Token-Optimized Object Notation) is a compact, YAML-like format designed to reduce token usage when sending data to LLMs. This package achieves 50% token reduction compared to JSON while maintaining full round-trip fidelity, backed by 470 tests. Installation Quick Start Output: Global Helper Functions For convenience, global helper functions are available: Collection Macro: toToon You can convert any Laravel collection directly to TOON format with the built-in toToon macro: Output: Eloquent Model: toToon Eloquent models have a toToon method, similar to toJson and toArray : Why TOON? When building MCP servers or LLM-powered applications, every token counts. JSON's verbosity wastes context window space with repeated keys and structural characters. JSON (201 bytes): TOON (62 bytes) - 69% smaller: Benchmarks For a typical paginated API response (50 records): - JSON : 7,597 tokens - TOON : 3,586 tokens - Saved : 4,000 tokens per request Real-world benchmarks from a production application with 17,000+ records: Data Type JSON TOON Savings ----------- ------ ------ --------- 50 records 30,389 bytes 14,343 bytes 53% 100 records 60,856 bytes 28,498 bytes 53% 500 records 303,549 bytes 140,154 bytes 54% 1,000 records 604,408 bytes 277,614 bytes 54% Features Tabular Format Arrays of uniform objects with primitive va","default_branch":null,"files":null,"tree":[],"storefront":"/r/mischasigtermans","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mischasigtermans/laravel-toon/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}