# symfony/serializer

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/symfony-serializer).**

2,547 stars · 75 forks · PHP · MIT

## Links

- GitHub: https://github.com/symfony/serializer
- Homepage: https://symfony.com/serializer
- awesome-repositories: https://awesome-repositories.com/repository/symfony-serializer.md

## Topics

`component` `php` `symfony` `symfony-component`

## Description

This library is a PHP-based serialization framework designed to convert complex object graphs into structured formats such as JSON, XML, YAML, and CSV, and to reconstruct those objects from serialized data. It functions as a data transformation tool that maps object properties to array structures, facilitating both application state persistence and the exchange of data between systems.

The framework distinguishes itself through a two-stage pipeline that normalizes objects into intermediate structures before encoding them into specific formats. It supports advanced mapping requirements, including the automatic resolution of polymorphic types and the transformation of property names between different naming conventions. Developers can define serialization rules directly on classes and properties using native language attributes, or apply metadata to third-party classes without modifying their original source code.

The system provides extensive configuration options to manage how data is processed, including the ability to define multiple serializer instances with unique rules and context-aware settings. It handles recursive object graph traversal and supports updating existing object instances during deserialization to enable partial data synchronization. The library is distributed as a package that integrates into PHP applications to manage object hydration, mapping, and structured data output.

## Tags

### Data & Databases

- [Object Serializers](https://awesome-repositories.com/f/data-databases/data-serialization-formats/data-formats/object-serializers.md) — Converts complex object graphs into structured formats like JSON, XML, or YAML and reconstructs them into typed objects.
- [Data Format Transformations](https://awesome-repositories.com/f/data-databases/data-format-transformations.md) — Converts complex object graphs into structured formats like JSON, XML, or YAML for transmission between systems.
- [Serialization Contexts](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/data-serialization/serialization-configuration-managers/serialization-contexts.md) — Injects runtime configuration objects to dynamically control formatting, timezones, and field visibility during transformation.
- [Persistent Application State](https://awesome-repositories.com/f/data-databases/persistent-application-state.md) — Saves and restores complex object graphs to persistent storage to maintain application state across sessions.
- [Polymorphic Deserialization](https://awesome-repositories.com/f/data-databases/polymorphic-data-modeling/polymorphic-deserialization.md) — Automatically instantiates the correct concrete classes when deserializing data into interfaces or abstract types.

### Development Tools & Productivity

- [Field-Level Metadata Annotations](https://awesome-repositories.com/f/development-tools-productivity/attribute-metadata-annotations/field-level-metadata-annotations.md) — Uses native language attributes to define serialization rules and property mappings directly on class definitions.
- [Data Hydration Tools](https://awesome-repositories.com/f/development-tools-productivity/php-development-tools/data-hydration-tools.md) — Provides a system for defining serialization rules using native language attributes to control data processing.
- [Attribute Metadata Annotations](https://awesome-repositories.com/f/development-tools-productivity/attribute-metadata-annotations.md) — Allows declaring serialization rules and constraints directly on classes and properties using native language attributes. ([source](https://github.com/symfony/serializer/blob/8.2/CHANGELOG.md))

### Programming Languages & Runtimes

- [Object Deserialization](https://awesome-repositories.com/f/programming-languages-runtimes/object-deserialization.md) — Parses serialized formats like JSON and XML back into typed objects by mapping structure fields to class properties. ([source](https://github.com/symfony/serializer/blob/8.2/README.md))
- [Object Serialization](https://awesome-repositories.com/f/programming-languages-runtimes/object-serialization.md) — Transforms complex object graphs into structured formats like JSON, XML, CSV, or YAML for storage or transmission. ([source](https://github.com/symfony/serializer#readme))

### Software Engineering & Architecture

- [Custom Object Hydration](https://awesome-repositories.com/f/software-engineering-architecture/custom-object-hydration.md) — Populates class instances by mapping incoming data fields directly to object properties while respecting type constraints.
- [Object-to-Data Mapping Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/data-modeling-frameworks/object-to-data-mapping-frameworks.md) — Maps raw data structures to typed model objects to ensure consistent and validated data models.
- [Nested Data Transformers](https://awesome-repositories.com/f/software-engineering-architecture/recursive-validation-engines/recursive-tree-traversers/data-structure-traversers/nested-data-transformers.md) — Maps object properties to array structures while managing naming conventions, nested paths, and polymorphic types.
- [Serialization Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/serialization-pipelines.md) — Processes data through a two-stage transformation flow that converts objects into intermediate arrays before encoding them into specific formats.
- [Recursive Object Graph Hydration](https://awesome-repositories.com/f/software-engineering-architecture/custom-object-hydration/recursive-object-graph-hydration.md) — Navigates complex nested object structures by recursively invoking normalizers to handle deep data hierarchies.
- [External Metadata Mappings](https://awesome-repositories.com/f/software-engineering-architecture/external-metadata-mappings.md) — Applying serialization rules to external classes without modifying their source code by mapping metadata to target objects.
- [In-Place Object Updating](https://awesome-repositories.com/f/software-engineering-architecture/object-instance-reuses/in-place-object-updating.md) — Updates existing object instances with new data during deserialization to facilitate partial updates and state synchronization. ([source](https://symfony.com/doc/current/components/serializer.html))
- [Polymorphic Type Mapping](https://awesome-repositories.com/f/software-engineering-architecture/polymorphic-type-mapping.md) — Uses discriminator maps to automatically instantiate the correct concrete class when deserializing interfaces or abstract types. ([source](https://symfony.com/doc/current/components/serializer.html))
