v1.22.0
[1.22.0] — 2026-08-05
Added
#[Computed]— adds a derived, method-backed field to serialization
output. Works on constructor-based, constructor-less, and hybrid classes.- Public, non-static, zero-required-parameter methods only; a method
requiring parameters throws at metadata-build time. - Default output key is the method name (subject to the class-level
#[TransformKeys]strategy, same as properties); override with
#[Computed('custom_key')]. - The return value is normalized the same way any other field is —
nestedBaseData, enums, andCollections serialize correctly. - Ignored on input, so
from($dto->toArray())keeps working;
#[RejectUnknownKeys]treats the computed key as known.
- Public, non-static, zero-required-parameter methods only; a method
- Documentation: see #[Computed].
Full Changelog: v1.21.0...v1.22.0