🐛 Bug Fix: Compare Method Improvement
This release fixes the compare method to properly showcase TOON's token savings benefits by always using the most efficient format.
Legacy Version: For PHP 7.0-8.0 support. For the latest version with modern PHP features (PHP 8.1+), see v2.x.
What's Changed
Fixed
Toon::compare()now always usescompact()format instead of accepting an\$optionsparameter- Removed confusing
\$optionsparameter to simplify API - Ensures
comparemethod consistently demonstrates TOON's best-case token savings - Updated docblock to clarify that compact format is used for comparison
Impact
The compare method is designed to showcase TOON's benefits over JSON. This fix ensures that:
- Comparisons always use the most token-efficient format (compact)
- Users see optimal, consistent token savings when using
compare() - The API is simpler and less error-prone
Installation
```bash
Automatic (Composer selects v1.x for PHP 7.0-8.0)
composer require iamgerwin/toon-php
Force v1.x
composer require iamgerwin/toon-php:^1.0
```
Features
- ✅ Complete TOON encoding/decoding for PHP 7.0-8.0
- ✅ 30-60% Token Savings vs JSON
- ✅ Zero Dependencies (pure PHP)
- ✅ PHPStan Level 6 (strict static analysis)
- ✅ 100% Test Coverage (32 tests, 66 assertions)
- ✅ PSR-12 Compliant
- ✅ Traditional PHP Syntax (compatible with PHP 7.0)
Documentation
Upgrade from v1.0.1
No breaking changes. Simply update:
```bash
composer update iamgerwin/toon-php
```
Full Changelog: v1.0.1...v1.0.2