LaravelToon is a production-ready Laravel package that integrates TOON (Token-Oriented Object Notation) for compressing and optimizing AI prompts and LLM contexts.
- Save 60-70% on LLM API costs
- Reduce tokens by 60-70% compared to JSON
- Multi-LLM support: OpenAI, Claude, Gemini, Mistral
- Deep analysis: Token counting, cost calculation, compression metrics
- � Native Laravel: Service providers, facades, Artisan commands
- Fully documented: 8 comprehensive guides
composer require squareetlabs/laravel-toon
php artisan toon:dashboard- PHP: 8.1+
- Laravel: 9.0-12.x
- License: MIT
- Dependencies: Minimal (Illuminate only)
| Metric | Value |
|---|---|
| Files | 40+ |
| Classes | 26 |
| Helpers | 22 |
| Commands | 4 |
| LLM Adapters | 5 |
| Lines of Code | ~3,500 |
| Type Safety | 100% |
| PHPStan Level | 9 |
ToonService- Compression and conversionTokenAnalyzer- Token estimationCompressionMetrics- Performance benchmarkingCostCalculator- LLM cost estimation
- OpenAI (GPT-4o, GPT-4, GPT-3.5-turbo)
- Anthropic (Claude 3 series)
- Google Gemini (Gemini Pro)
- Mistral (Mistral Large/Medium/Small)
- 22 global helper functions
- Artisan commands (convert, analyze, benchmark, dashboard)
- Eloquent model trait
- Validation rules
- Middleware for auto-compression
- README (English & Spanish)
- Installation guide
- Quick start guide
- 10+ code examples
- Architecture documentation
- Comprehensive API docs
Compress large datasets before sending to ChatGPT/Claude, saving 60-70% tokens.
Optimize context for Retrieval-Augmented Generation pipelines.
Track and control API expenses with budget analysis tools.
Compare costs across OpenAI, Claude, Gemini, and Mistral.
Send large logs to AI for analysis with minimal token usage.
- Email: labs@squareet.com
- Website: https://squareet.com
- Issues: GitHub Issues
- Docs: README.md and guides
LaravelToon v1.0.0 - November 14, 2025