All notable changes to data-transfer-object
will be documented in this file
- Add test for "Cannot use positional argument after named argument during unpacking" error by @Kehet in #302
- Fix positional after named by @aidan-casey in #304
- @Kehet made their first contribution in #302
Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.9.0...3.9.1
- allow enum casting not only enum value casting by @regnerisch in #301
- @regnerisch made their first contribution in #301
Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.8.1...3.9.0
- Fixed bug #249 by @gerpo in #251
Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.8.0...3.8.1
- Added enum caster by @Elnadrion in #277
- @Raja-Omer-Mustafa made their first contribution in #271
- @Elnadrion made their first contribution in #277
Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.7.3...3.8.0
- Stop suggesting phpstan/phpstan by @ymilin in #264
- @sergiy-petrov made their first contribution in #246
- @damms005 made their first contribution in #255
- @ymilin made their first contribution in #264
Full Changelog: https://github.com/spatie/data-transfer-object/compare/3.7.2...3.7.3
#[Strict]
is passed down the inheritance chain so children are strict when parent is strict (#239)
- Cast properties with self or parent type (#236)
- Add
#[MapTo]
support (#233)
- Correct behavior of Arr::forget with dot keys (#231)
- Fix array assignment bug with strict dto's (#225)
- Support mapped properties (#224)
- Support union types in casters (#210)
- 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 theitemType
(#217)
- Expose DTO and validation error array in ValidationException (#213)
- Support generic casters (#199)
- Add
ArrayCaster
- Add casting of objects that implement
ArrayAccess
to theArrayCaster
(#206) - Fix for caster subclass check (#204)
- Make
DefaultCast
repeatable (#202)
- Add
DataTransferObject::clone(...$args)
- Support union types (#185)
- Resolve default cast from parent classes (#189)
- Support default values (#191)
- Fix when nested DTO have casted field (#178)
- Allow valid DTOs to be passed to caster (#177)
- Fix for null values with casters
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]
- Add support for using
collection
internally
This might be a breaking change, but it was required for a bugfix
- Prevent DataTransferObjectCollection from iterating over array copy (#166)
- Fix for incorrect return type (#164)
- Allow the traversal of collections with string keys
- Cast nested collections (#117)
- Support PHP 8
- Group type errors (#130)
- Support for
array<int, string>
syntax (#136)
- Add PHPStan extension to support
checkUninitializedProperties: true
(#135)
- Validator for typed 7.4 properties (#109)
- Add support for typed properties to DTO casting in PHP 7.4
- Bump minimum required PHP version to 7.4
- Support for nested immutable DTOs (#86)
- Ignore static properties when serializing (#88)
- DataTransferObjectError::invalidType : get actual type before mutating $value for the error message (#81)
- Improve extendability of DTOs (#80)
- Ignore static properties (#82)
- Add
DataTransferObject::arrayOf
(#83)
- Improved performance by adding a cache (#79)
- Add
FlexibleDataTransferObject
which allows for unknown properties to be ignored
- Add
iterable
anditerable<\Type>
support
- Allow a DTO to be constructed without an array (#68)
- Improve type error message
- Add DataTransferObjectCollection::items()
- Support immutability
- Fixes #47, allowing empty dto's to be cast to using an empty array.
- Nested array DTO casting supported.
- Properly support
float
.
- Fix uninitialised error with default value.
- Don't use
allValues
anymore.
- Support nested collections in collections
- Cleanup code
- Remove too much magic in nested array casting
- Support nested
toArray
in collections.
- Support nested
toArray
.
- Add strict type declarations
- Add auto casting of nested DTOs
- Rename to data-transfer-object
- Add uninitialized errors.
- Support instanceof on interfaces when type checking
- proper support for collections of value objects
- initial release