A Symfony bundle for transforming PHP objects into JSON API-compliant responses with mapping configuration.
Symfony JSON-API Transformer Bundle is a Symfony bundle that transforms PHP objects into JSON API-compliant responses. It solves the problem of manually building complex JSON API structures by providing configuration-based mapping and automatic serialization. The bundle handles relationships, links, and included resources according to the JSON API specification.
Symfony developers building RESTful APIs that need to comply with the JSON API specification. Particularly useful for teams implementing standardized API responses with complex object relationships.
Developers choose this bundle because it eliminates the boilerplate code required for JSON API compliance while providing fine-grained control through YAML mapping configurations. It integrates seamlessly with Symfony's service container and works well with Doctrine repositories.
JSON API Transformer Bundle for Symfony 2 and Symfony 3
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generates fully compliant JSON API responses with correct structure, links, relationships, and included resources, as shown in the detailed output example for a Post object with nested User and Comment data.
Uses YAML mapping files for fine-grained control over property aliasing, hiding, and relationship definitions, allowing developers to tailor serialization without modifying domain objects, evidenced by the multiple mapping files for Post, Comment, and User.
Integrates with Symfony's service container for easy serializer injection and provides a JsonApiResponseTrait for standardized HTTP responses, simplifying controller code as demonstrated in the PostController example.
Works with NelmioApiDocBundle for API documentation generation, including configuration examples for setting up request/response formats aligned with JSON API media types.
Explicitly targets only Symfony 2 and 3 per the README, lacking official updates for newer Symfony versions, which may require community forks or compatibility workarounds for modern applications.
Requires a separate YAML mapping file for every domain object and value object, leading to configuration bloat and maintenance overhead in large codebases, as seen with six files needed for a simple Post example.
URL generation in responses depends on Symfony route names specified in mappings, making refactoring routes more error-prone and tightly coupling serialization logic to application routing.