Skip to content

v1.7.2

Choose a tag to compare

@yuriizee yuriizee released this 03 Jul 11:20

Universal from() + lazy hydration

✨ Added

  • Universal from() — one factory now accepts arrays (unchanged fast path), Eloquent models and any Arrayable, stdClass, JsonSerializable, any Traversable, 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.preload recipe.

⚡ 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 of from().

🐛 Fixed

  • HydratorCompiler::compile() fails fast when given a non-BaseData class.

Full Changelog: v1.4.3...v1.7.2