v1.7.2
Universal from() + lazy hydration
✨ Added
- Universal
from()— one factory now accepts arrays (unchanged fast path), Eloquent models and anyArrayable,stdClass,JsonSerializable, anyTraversable, JSON strings, plain objects with public properties, and same-class instances (returned as-is). All detection lives on the cold path — the hot array path executes the same opcodes as before. BaseData::fromLazy()— lazy hydration built on native PHP 8.4 lazy ghosts; hydration runs on first property access. With ~10% of objects actually read: ~3× faster on cast-heavy DTOs, ~6× with nested collections.- Integrations docs — Plain PHP, Laravel, Symfony, Slim/PSR-7, plus an
opcache.preloadrecipe.
⚡ Changed
- Compiled hydrator hoisted out of collection loops (
TypedDataCollection::of(),lazyCollection()): +19% on collection hydration (220k → 267k ops/s). fromJson()is now an explicit alias offrom().
🐛 Fixed
HydratorCompiler::compile()fails fast when given a non-BaseDataclass.
Full Changelog: v1.4.3...v1.7.2