v2.0.3 - Compare Method Fix
🐛 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.
What's Changed
Fixed
Toon::compare()now always usescompact()format instead of accepting an$optionsparameter- Removed confusing
$optionsparameter to simplify the 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 (recommended for PHP 8.1+)
composer require iamgerwin/toon-php
Force v2.x
composer require iamgerwin/toon-php:^2.0
```
Features
- ✅ Full Enum Support (BackedEnum, UnitEnum)
- ✅ Modern PHP 8.1+ Syntax (constructor promotion, match expressions, arrow functions)
- ✅ 30-60% Token Savings vs JSON
- ✅ Zero Dependencies (pure PHP)
- ✅ PHPStan Level 6 (strict static analysis)
- ✅ 100% Test Coverage (29 tests, 63 assertions)
- ✅ PSR-12 Compliant
Documentation
Upgrade from v2.0.2
No breaking changes. Simply update:
```bash
composer update iamgerwin/toon-php
```
Full Changelog: v2.0.2...v2.0.3