vitek-dev/nette-json-serializer

JSON-preconfigured symfony/serializer integration into Nette

v1.1.0 2025-08-05 09:34 UTC

This package is auto-updated.

Last update: 2025-08-05 11:09:10 UTC


README

Preconfigured symfony/serializer for Nette Framework.

Features

  • Serialize and deserialize PHP objects to/from JSON
  • Handles nested objects and arrays (via PHPDoc annotations)
  • Enums support
  • Discriminators
  • Syntax sugar for Guzzle: Ability to directly deserialize MessageInterface/StreamInterface

Requirements

  • PHP 8.4 or higher

Installation

composer require vitek-dev/nette-json-serializer
extensions:
    vd.serializer: VitekDev\Serializer\DI\JsonSerializerExtension

Known issues

Class with no properties

Deserialization of class with no properties will end up with NotNormalizableValueException

class Garage {
    /**
     * @param Car[] $cars
     */
    public function __construct(
        public array $cars,
    ) {}
}

class Car {
    // No properties
}