api-platform-serialization

Installation
SKILL.md

Api Platform Serialization (Symfony)

Use when

  • Operations must expose different fields (list, read, create, update).
  • A related resource must render as an IRI or be embedded.
  • A response needs computed or role-dependent fields.
  • A property needs normalizer options such as a date format.

Default workflow

  1. Name groups entity:operation and set normalizationContext and denormalizationContext per operation.
  2. Tag properties with #[Groups] from the Serializer Attribute namespace, not the old Annotation one.
  3. Control relations with #[ApiProperty(readableLink: false, writableLink: false)] to force IRIs.
  4. Apply per-property options with #[Context] instead of writing a normalizer.
  5. Add computed fields in a custom normalizer, and dynamic groups in a decorator of api_platform.serializer.context_builder.
  6. Prevent cycles with #[MaxDepth] and enable_max_depth, and hide secrets with #[Ignore].
Installs
64
GitHub Stars
224
First Seen
Sep 18, 2026