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

Value Object Laravel Package

spatie/value-object

Deprecated Spatie package for PHP 8+ data transfer objects. Create typed DTOs from arrays with casting, validation, and attribute mapping (e.g., nested keys). Consider migrating to spatie/laravel-data or cuyz/valinor.

View on GitHub
Deep Wiki
Context7
3.9.1

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.9.0...3.9.1

3.9.0

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.8.1...3.9.0

3.7.3
3.7.2
  • #[Strict] is passed down the inheritance chain so children are strict when parent is strict (#239)
3.7.1
  • Cast properties with self or parent type (#236)
3.7.0
  • Add #[MapTo] support (#233)
3.6.2
  • Correct behavior of Arr::forget with dot keys (#231)
3.6.1
  • Fix array assignment bug with strict dto's (#225)
3.6.0
  • Support mapped properties (#224)
3.5.0
  • Support union types in casters (#210)
3.4.0
  • Fix for an empty value being created when casting ArrayAccess objects (#216)
  • Add logic exception when attempting to cast ArrayAccess objects that are not traversable (#216)
  • Allow the ArrayCaster to retain values that are already instances of the itemType (#217)
3.3.0
  • Expose DTO and validation error array in ValidationException (#213)
3.2.0
  • Support generic casters (#199)
  • Add ArrayCaster
  • Add casting of objects that implement ArrayAccess to the ArrayCaster (#206)
  • Fix for caster subclass check (#204)
3.1.1
  • Make DefaultCast repeatable (#202)
3.1.0
  • Add DataTransferObject::clone(...$args)
3.0.4
  • Support union types (#185)
  • Resolve default cast from parent classes (#189)
  • Support default values (#191)
3.0.3
  • Fix when nested DTO have casted field (#178)
3.0.2
  • Allow valid DTOs to be passed to caster (#177)
3.0.1
  • Fix for null values with casters
3.0.0

This package now focuses only on object creation by adding easy-to-use casting and data validation functionality. All runtime type checks are gone in favour of the improved type system in PHP 8.

  • Require php:^8.0
  • Removed all runtime type checking functionality, you should use typed properties and a static analysis tool like Psalm or PhpStan
  • Removed Spatie\DataTransferObject\DataTransferObjectCollection
  • Removed Spatie\DataTransferObject\FlexibleDataTransferObject, all DTOs are now considered flexible
  • Removed runtime immutable DTOs, you should use static analysis instead
  • Added Spatie\DataTransferObject\Validator
  • Added Spatie\DataTransferObject\Validation\ValidationResult
  • Added #[DefaultCast]
  • Added #[CastWith]
  • Added Spatie\DataTransferObject\Caster
  • Added #[Strict]
2.8.3
  • Add support for using collection internally
2.8.2

This might be a breaking change, but it was required for a bugfix

  • Prevent DataTransferObjectCollection from iterating over array copy (#166)
2.8.1
  • Fix for incorrect return type (#164)
2.8.0
  • Allow the traversal of collections with string keys
2.7.0
  • Cast nested collections (#117)
2.6.0
  • Support PHP 8
2.5.0
  • Group type errors (#130)
2.4.0
  • Support for array<int, string> syntax (#136)
2.3.0
  • Add PHPStan extension to support checkUninitializedProperties: true (#135)
2.2.1
  • Validator for typed 7.4 properties (#109)
2.2.0
  • Add support for typed properties to DTO casting in PHP 7.4
2.0.0
  • Bump minimum required PHP version to 7.4
  • Support for nested immutable DTOs (#86)
1.13.3
  • Ignore static properties when serializing (#88)
1.13.2
  • DataTransferObjectError::invalidType : get actual type before mutating $value for the error message (#81)
1.13.1
  • Improve extendability of DTOs (#80)
1.13.0
  • Ignore static properties (#82)
  • Add DataTransferObject::arrayOf (#83)
1.12.0
  • Improved performance by adding a cache (#79)
  • Add FlexibleDataTransferObject which allows for unknown properties to be ignored
1.11.0
  • Add iterable and iterable<\Type> support
1.10.0
  • Allow a DTO to be constructed without an array (#68)
1.9.1
  • Improve type error message
1.9.0
  • Add DataTransferObjectCollection::items()
1.8.0
  • Support immutability
1.7.1
  • Fixes #47, allowing empty dto's to be cast to using an empty array.
1.7.0
  • Nested array DTO casting supported.
1.6.6
  • Properly support float.
1.6.5
  • Fix uninitialised error with default value.
1.6.4
  • Don't use allValues anymore.
1.6.3
  • Support nested collections in collections
  • Cleanup code
1.6.2
  • Remove too much magic in nested array casting
1.6.1
  • Support nested toArray in collections.
1.6.0
  • Support nested toArray.
1.5.1
  • Add strict type declarations
1.5.0
  • Add auto casting of nested DTOs
1.4.0
  • Rename to data-transfer-object
1.2.0
  • Add uninitialized errors.
1.1.1
  • Support instanceof on interfaces when type checking
1.1.0
  • proper support for collections of value objects
1.0.0
  • initial release
What's
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