Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Object Hydrator Laravel Package

eventsauce/object-hydrator

Magic-less object hydration and serialization for PHP. Map arrays/decoded JSON to DTOs, commands, queries, and events by inspecting constructors and public getters—no private-property reflection. Supports custom keys, casting, and optional code generation for speed.

View on GitHub
Deep Wiki
Context7
1.1.0

Added

  • Added ability to omit all public method from serialization.
  • Added ability to omit all public properties from serialization.
  • Added ability to omit specific public methods and properties from serialization.
1.0.0
  • Functionally equivalent to 0.5.5, stable release.
0.5.5
  • Support nullable enum properties #28
0.5.4

Fixed

  • Fix typo in PHPDoc parser regex pattern #27
0.5.3

Fixed

  • Fix cache keys colliding when using multiple casters without options #26
0.5.2

Fixed

  • Ignore use function/const statements when resolving the use statement map (#25)
0.5.1

Fixed

  • Handle omission of data for nullable parameters and parameters with a default
0.5.0

Added

  • Expose missing fields in UnableToHydrate exception.
  • Added information about which property caused hydration failure.
0.4.3

Fixed

  • Prevent type-error when casting null values for nullable properties (#23)
0.4.2

Fixed

  • Fixed phpstan template notations.
0.4.1

Added

  • The CastToDateTimeImmutable caster now supports setting a timezone.
0.4.0

Deprecations

  • The ObjectHydrator class was deprecated, use ObjectMapperUsingReflection and hint against the new ObjectMapper interface.
  • The ListOfObjects class was deprecated, use the IterableList object instead.
  • The KeyFormattingWithoutConversion class was deprecated, use the KeyFormatterWithoutConversion class instead.

Breaking Changes

  • The ObjectHydrator class was converted into an interface named ObjectMapper, the main implementation is ObjectMapperUsingReflection.
  • The PropertyDefintion class was renamed to PropertyHydrationDefinition to be symmetrical with the new PropertySerializationDefinition.
  • The DefinitionProvider::provideDefinition method was deprecated in favour of the new provideHydrationDefinition for symmetry with provideSerializationDefinition.
  • The KeyFormatter interface was changed by adding a keyToPropertyName method, needed for serialization.
  • The ObjectHydrator::hydrateObjects return type class was renamed from ListOfObjects to IterableList.

Added

  • The ObjectMapper interface was introduced, which represents both generated and reflection based mappers.
  • [Major Feature] Serialization was added to the main ObjectHydrator interface.
  • Array hydration now also has rudimentary support for docblock type hints ([@param](https://github.com/param) Type[] $name, [@param](https://github.com/param) array<Type> $name, [@param](https://github.com/param) array<string, Type> $name).
0.3.1

Fixed

  • Allow same hydrator to be used with different constructor options.
0.3.0

Added

  • Added ability to define nested input (#12)
0.2.0

Added

  • Added hydrateObjects; a way to hydrate a list of objects in one go
0.1.0

Added

  • Initial implementation of the object hydrator
1.8.0

Fixed

  • PHP 8.5 support
  • Align serialize with hydrator picking up nested DTOs when #93 (by @WyriHaximus)
1.7.0

Added

  • Be able to filter out NULL values.
  • Default caster for DateTimeZone

Fixed

  • Be able to assign more casters to promoted properties
1.6.1

Fixes

  • Fix PHP 8.4 deprecations
1.6.0

Added

  • Added interface for custom constructor resolution

Fixes

  • Skip parsing of closure use statements
1.5.0

Improved

  • Default to empty array in default serializer repository
  • Allow skipping public method serialization
  • Allow hydrating an array of enums.
  • Serialize unit enums to their name.
1.4.0

Fixed

  • [Regression] Casters returning null causes problem for hydrator enums.

Improved

  • Naive property type resolving now handles a bunch more cases.
1.3.1

Fixed

  • Only try to resolve one property from the docblock to prevent parsing error (#50)
1.3.0

Added

  • This is not a joke release.
  • MapperSettings can now also be specified using an interface.
1.2.0

Added

  • Added ability to define polymorhic object mapping (#29)
1.1.3

Fixed

  • Add mixed as native type in NaivePropertyTypeResolver (#40)
1.1.2

Fixed

  • Ensure generic template is of object type (#36)
  • Prevent method name collisions in case SomeThing and Some\Thing both exist
1.1.1

Fixed

  • Corrected @template generic usage for generated hydrator
  • Prevented exception when scalar type is resolved from a docblock
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport