- What is TOON and why would I use synapse-toon in a Laravel app?
- TOON (Token-Oriented Object Notation) is a compact alternative to JSON for structured data sent to LLMs. synapse-toon gives Laravel apps one-line JSON to TOON encoding with round-trip decoding, so prompts and payloads keep their structure while consuming fewer input tokens. Fewer input tokens means lower cost and latency on every LLM request.
- How do I install vinkius-labs/synapse-toon?
- Install it with composer require vinkius-labs/synapse-toon. Laravel 11 and 12 auto-discover the service provider and facade, so no manual registration is needed, and you can publish the config file if you want to tune encoding. The package requires PHP 8.2 or 8.3.
- Which Laravel and PHP versions does synapse-toon support?
- The package targets Laravel 11 and 12 with PHP 8.2 and 8.3, and its service provider is auto-discovered. PHP 8.4 is not listed in the release notes, so verify the constraint in composer.json before upgrading your runtime. Check the repository for the current support and maintenance policy.
- Can I encode Eloquent models and API resources to TOON?
- Yes. The encoder accepts plain PHP arrays, Eloquent models, and API resources, so you can convert an existing response payload to TOON at the outbound LLM boundary. Keep your JSON serialization canonical and treat TOON as a derived representation used only for the model call.
- How many tokens does TOON actually save compared to JSON?
- The release notes cite roughly 40 percent input token reduction on some payloads, but those figures are input token counts, not quality-adjusted ones, and the benchmark table does not name the tokenizer used. cl100k, o200k, Claude, and Gemini tokenizers all count differently, so measure against your own prompts. Gate adoption on an eval harness rather than a token dashboard.
- Will OpenAI, Claude, or Gemini parse TOON as reliably as JSON?
- TOON is a non-standard format, so model-family sensitivity is unknown and the release notes do not publish a grammar or spec. The risk is a silent quality regression: no exception and no 500, just worse answers. Pilot on the exact models you use, keep an eval harness in the loop, and keep a JSON fallback path ready.
- Is the JSON to TOON conversion lossless, and can I decode it back?
- Round-trip decoding is supported within this package, so arrays encoded to TOON can be decoded back. That lossless claim applies to the package's own encoder and decoder pair, not to any third-party implementation. An independently implemented decoder would let you validate output without trusting the same code that produced it.
- How do I configure TOON formatting and compression?
- Configuration is published through the package's config file and covers formatting options aimed at maximizing token savings. Start from the defaults, then compare encoded output against your real payloads to see what the formatting actually buys you. The facade gives you a simple encode call wherever you build the prompt.
- Is it safe to cache TOON-encoded LLM payloads in Redis, and what about PII?
- Encoded LLM payloads stored in a Redis edge cache are still PII, just less readable to a human reviewer, so apply the same retention and access rules you would for JSON. The package has no stated schema or version header on cached entries, so a codec upgrade can invalidate or mis-decode warm entries. Also confirm that encoding does not route content past outbound guardrails tuned for JSON.
- Does synapse-toon replace JSON in my API, and should I adopt the bundled router and RAG modules?
- No, JSON stays canonical: TOON is a derived outbound representation, so there is nothing to migrate in your API contract. The release also bundles an SSE streamer, edge cache, LLM router, RAG service, GraphQL adapter, and batch job, but only the codec is core to the value proposition. Treat the router and RAG pieces as a separate adoption decision, since they add dependencies far more consequential than a serializer.