Download the PHP package vinkius-labs/synapse-toon without Composer
On this page you can find all versions of the php package vinkius-labs/synapse-toon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vinkius-labs/synapse-toon
More information about vinkius-labs/synapse-toon
Files in vinkius-labs/synapse-toon
Package synapse-toon
Short Description Synapse TOON - high-performance API payload optimization and streaming toolkit for Laravel 11/12
License Apache-2.0
Informations about the package synapse-toon
Synapse TOON
High-performance API payload optimization engine for Laravel
Synapse TOON transforms verbose JSON API responses into ultra-dense representations, reducing token consumption by 25–45% while preserving full semantic fidelity. Ship faster APIs and pay dramatically less for LLM inference.
Every runtime surface ships with an explicit SynapseToon prefix, making package ownership obvious in your codebase and eliminating class-name collisions.
Highlights
- Cost Savings First — Reduce LLM API bills by 25–45% through entropy-aware encoding, adaptive compression, and smart routing.
- Performance Native — HTTP/3 detection, Brotli/Gzip negotiation, and SSE streaming deliver sub-100 ms response times.
- Observable by Default — Log, Prometheus, and Datadog drivers expose savings metrics and ROI in real time.
- Production Ready — Queue-aware batch jobs, edge caching, and complexity-aware routing keep high-traffic APIs responsive.
- Framework Native — Middleware aliases, response macros, and Octane preloading for zero-friction Laravel integration.
- Zero Lock-in — Bring your own vector stores, LLM clients, and cache drivers via lightweight contracts.
Requirements
| Dependency | Version |
|---|---|
| PHP | 8.2+ |
| Laravel | 11.x | 12.x |
| ext-brotli | Optional (recommended) |
| ext-zlib | Optional |
Installation
Publish the configuration file:
Register middleware in bootstrap/app.php:
Quick Start
Encode a response
Stream an LLM response
Route by complexity
Build RAG context
Dispatch a batch job
Architecture Overview
| Component | Purpose |
|---|---|
SynapseToonEncoder / SynapseToonDecoder |
Lossless TOON codec with dictionary support and entropy-aware heuristics |
SynapseToonCompressor |
Adaptive Brotli, Gzip, and Deflate selection based on Accept-Encoding |
SynapseToonSseStreamer |
Server-Sent Events with zero-copy chunking and buffer flush guardrails |
SynapseToonEdgeCache |
Encode-once edge cache helper tuned for Redis and Octane workloads |
SynapseToonMetrics |
Driver-agnostic metrics (Log, Prometheus, Datadog, or custom drivers) |
SynapseToonProcessLLMBatchJob |
Queue-friendly batch encoder for up to 100 prompts per dispatch |
SynapseToonLLMRouter |
Complexity-aware model router with pluggable LLM client implementations |
SynapseToonRagService |
Vector-store abstraction with snippet thresholds and metadata braiding |
SynapseToonGraphQLAdapter |
Lighthouse / Rebing GraphQL pipeline with TOON encoding built in |
SynapseToonPayloadAnalyzer |
Token analytics and savings calculator for middleware and dashboards |
Real-World Impact
| Scenario | Before | After | Savings |
|---|---|---|---|
| E-commerce feed (500 items) | 47,200 tokens | 26,100 tokens | 44.7% |
| Chat completion with context | 3,840 tokens | 2,310 tokens | 39.8% |
| GraphQL nested query | 2,156 tokens | 1,405 tokens | 34.8% |
| RAG context injection | 1,920 tokens | 1,152 tokens | 40.0% |
| Batch job (50 prompts) | 12,500 tokens | 7,000 tokens | 44.0% |
Average token reduction: 40.7%
Documentation
| Guide | Description |
|---|---|
| Getting Started | Installation, first response, and quick tips |
| Configuration | Full reference for every config option |
| Encoding & Compression | TOON algorithm deep-dive and compression strategies |
| Streaming & SSE | Server-Sent Events for real-time LLM responses |
| Metrics & Analytics | Prometheus, Datadog, and custom driver setup |
| RAG Integration | Vector-store abstraction and context building |
| Batch Processing | Queue-native batch encoding and fan-out |
| GraphQL Adapter | Lighthouse / Rebing integration |
| Edge Cache | Multi-tier caching strategies |
| HTTP/3 Optimization | HTTP/3 detection and header optimization |
| Cost Optimization | Maximize ROI with concrete strategies |
| Performance Tuning | Latency and throughput optimization |
| Technical Reference | Container bindings, macros, and full API |
Testing
Run the test suite locally via Docker:
Or, if you have PHP 8.2+ installed locally:
Compatibility
| Component | Support |
|---|---|
| Laravel | 11.x, 12.x |
| PHP | 8.2, 8.3 |
| Octane | Swoole, RoadRunner, FrankenPHP |
| HTTP/3 | Full detection and optimization |
| Brotli | Optional (ext-brotli) |
Contributing
Contributions are welcome! Please read our Contributing Guide before submitting a pull request.
Security
If you discover a security vulnerability, please review our Security Policy. Do not open a public issue.
Changelog
All notable changes are documented in the Changelog.
License
Copyright 2026 Vinkius Labs
Licensed under the Apache License, Version 2.0. See LICENSE for the full text.
All versions of synapse-toon with dependencies
illuminate/support Version ^11.0 || ^12.0
guzzlehttp/guzzle Version ^7.0