{"repo":"Pixelshaped/flat-mapper-bundle","free":true,"listed":false,"github":"https://github.com/Pixelshaped/flat-mapper-bundle","clone":"git clone https://github.com/Pixelshaped/flat-mapper-bundle.git","description":"Object mapper for denormalized data. Transform flat arrays (like database JOIN results) into nested, typed DTOs without the overhead of a full ORM.","language":"PHP","stars":13,"topics":["database","ddd","dto","mapper","normalization"],"license":"MIT","category":"databases-storage","readme_excerpt":"Flat Mapper Bundle Object mapper for denormalized data. Transform flat arrays (like database JOIN results) into nested, typed DTOs without the overhead of a full ORM. The Problem When you write efficient SQL JOINs, you get back flat, denormalized rows where parent data repeats across child records: But you want clean, nested DTOs for your application: FlatMapper does this transformation automatically , handling: - Deduplication (one AuthorDTO per unique author despite repeated rows) - Relationship reconstruction (grouping books under their authors) - Nested object hierarchies (DTOs containing arrays of other DTOs) - Type safety (strongly-typed DTOs with PHP attributes) And it's fast. FlatMapper outperforms Doctrine entity hydration for read operations—even without N+1 queries. See benchmarks comparing FlatMapper to Doctrine entities, partial objects, and manual mapping. Quick Start Installation Basic Usage 1. Define your DTOs with attributes: 2. Map your flat results: That's it! You now have properly structured AuthorDTO objects with nested BookDTO arrays. How It Works Mapping Attributes FlatMapper uses PHP attributes to define how flat data maps to your DTOs: #[Identifier] - Required Every DTO needs exactly one identifier to track unique instances: #[Scalar(\"column name\")] - Optional Maps a column from your result set to a scalar property. Omit if property names match column names: #[ReferenceArray(NestedDTO::class)] - For nested objects Creates an array of nested DTOs from ","default_branch":null,"files":null,"tree":[],"storefront":"/r/Pixelshaped","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Pixelshaped/flat-mapper-bundle/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}