Skip to content

Releases: aternosorg/php-serializer

v1.5.0

18 Jun 10:47
eb2970e

Choose a tag to compare

Additions

  • You can now deserialize classes with private or protected constructors
  • You can now deserialize classes with constructor parameters if they use the Serialize attribute

Improvements

  • Template bounds are now specified in PHPDoc
  • Added missing @throws to DeserializerInterface
  • Added note about intersection types with custom deserializers to the README

Full Changelog: 1.4.0...1.5.0

v1.4.0

07 Aug 12:45
c74ead9

Choose a tag to compare

What's Changed

  • Add BackedEnumSerializer to serialize enums

This is useful if your object contains arrays of enums. Just use it as the item serializer:

#[Serialize(itemSerializer: new BackedEnumSerializer())]
protected array $backedEnumArray = [
    TestBackedEnum::A,
];

Full Changelog: 1.2.0...1.3.0

1.3.1

07 Aug 12:36
d524680

Choose a tag to compare

What's Changed

  • Fix exception if another property appears after property using itemSerializer
  • Add missing throws tag to JsonDeserializer

Full Changelog: 1.2.0...1.3.0

1.1.0

28 Oct 11:46
d524680

Choose a tag to compare

What's Changed

  • Add custom serializers and deserializers for individual properties by @KurtThiemann

Serializer and Deserializer

A custom Serializer and Deserializer can be specified for a property.
This can be useful if you want to serialize a specific property in a different way.

#[Serialize(serializer: new Base64Serializer(), deserializer: new Base64Deserializer(TestClass::class))]
protected TestClass $example;

Note that the custom Deserializer is responsible for returning the correct type.
If an incompatible type is returned, an IncorrectTypeException is thrown.

New Contributors

Full Changelog: 1.0.0...v1.1.0

v1.3.0

28 Oct 16:28
6cc59c0

Choose a tag to compare

What's Changed

  • Support serializing and deserializing backed enums by @KurtThiemann in #4

Note

Serialization and deserialization of unit enums is not supported.

Full Changelog: 1.2.0...1.3.0

v1.2.0

28 Oct 12:45
87b7426

Choose a tag to compare

What's Changed

  • Add custom serializers and deserializers for array items by @KurtThiemann in #3

Item Serializer and Item Deserializer

Custom Serializers and Deserializers can now also be specified for array items.

#[Serialize(itemSerializer: new Base64Serializer(), itemDeserializer: new Base64Deserializer(TestClass::class))]
protected array $example = [];

Full Changelog: v1.1.0...1.2.0

v1.0.0

02 Oct 11:55
169a1d5

Choose a tag to compare

What's Changed

New Contributors

  • @pavog made their first contribution in #1

Full Changelog: https://github.com/aternosorg/php-serializer/commits/1.0.0