Symfony Serializer Component

repository·8.2·Indexed 25 days ago

https://github.com/symfony/serializer

A component for converting data structures and complex object graphs into formats such as JSON, XML, or arrays, and reconstructing those structures via deserialization. Includes the `debug:serializer` command to inspect serialization metadata like groups, names, and discriminator mappings for specific classes.

Tokens
379
Snippets
0
Records
3
Agent score
32%

What's inside symfony/serializer

  1. Overview of the Serializer Component

    8.2
    The Serializer component provides functionality to convert data structures (including complex object graphs) into different formats such as JSON, XML, or arrays, and vice versa (deserialization).
  2. Use the debug:serializer command arguments and output

    8.2

    The debug:serializer command accepts one argument:

    • class (Required): The fully qualified class name (FQCN) you want to inspect.

    Output Format: If the class is found and has metadata, the command displays a table with two columns:

    1. Property: The name of the property being inspected.
    2. Options: A dumped representation of the metadata associated with that property, including:
      • groups: The serialization groups assigned to the property.
      • maxDepth: The maximum depth allowed for this property.
      • serializedName: The name used during serialization.
      • serializedPath: The path used during serialization.
      • ignore: Whether the property is ignored.
      • normalizationContexts: Contexts used during normalization.
      • denormalizationContexts: Contexts used during denormalization.
      • discriminatorMap: (If applicable) The mapping of types for class discriminators.
  3. Debug serialization information with debug:serializer

    8.2

    The debug:serializer command allows you to inspect the serialization metadata (groups, names, depth, etc.) configured for a specific class. This is useful for verifying that attributes like #[Groups], #[SerializedName], or discriminator mappings are correctly recognized by the Serializer component.

    To use the command, provide the fully qualified class name (FQCN) as a required argument.