pixelshaped/flat-mapper-bundle
Symfony bundle for the Flat Mapper library, enabling fast mapping between flat arrays and PHP objects. Configure mappings with attributes or PHP, then hydrate DTOs from database rows, forms, or API payloads and flatten objects back with minimal boilerplate.
Architecture fit. Release 2.4.0 adds YAML mapping to Pixelshaped/flat-mapper-bundle via PR #28. First and most important architectural note: despite the framing as a "Laravel/PHP package," this is a Symfony bundle, not a Laravel package. It integrates through Symfony's bundle registration, DI container, and configuration system. It will not drop into a Laravel service provider cleanly and should be treated as a Symfony-only dependency until proven otherwise. For a Symfony-based estate, the fit is good: mapping is the kind of cross-cutting concern that benefits from being declared as configuration rather than scattered as PHP attributes, and YAML is the native idiom in Symfony projects already.
The substantive change is small and additive: a new mapping-definition format alongside whatever was previously supported (annotations/attributes or PHP config). That is a configuration-surface expansion, not a new runtime engine. The mapping semantics should be identical, which keeps the blast radius low but also means the value is ergonomic (declarative mappings in config, reviewable in diffs, editable by non-PHP staff) rather than functional.
Integration feasibility. Low-to-moderate. It is a minor version bump (2.3.1 → 2.4.0) with one contributor PR and no deprecation or breaking-change notes in the changelog. Assuming standard semantic versioning, existing PHP-attribute mappings continue to work untouched, so adoption is opt-in per mapping. The real work is not code — it is deciding where YAML mapping files live, how they are discovered, how they are validated in CI, and whether the app's config cache correctly invalidates when they change. Those are process and tooling questions that the release notes do not answer.
Technical risk. Predominantly low, with three caveats:
yes → boolean, unquoted numerics in identifiers). Symfony's YAML parser is safe by default, but schema drift is a genuine ongoing cost.Key questions. What is the YAML schema, and is it expressive enough for every mapping pattern currently in use (nested, collections, custom transformers, conditional mapping)? Is there a documented precedence rule when YAML and attribute mappings target the same class? Are YAML files compiled into the container cache, and what invalidates that cache? Is there validation tooling (a lint command, a JSON Schema) or must we build our own? Does 2.4.0 have any transitive dependency changes pulled in by the PR? Who maintains this bundle — bus factor and release cadence matter more than usual for a one-PR release. And, critically: is there any Laravel path at all, or is this a hard Symfony-only adoption?
Stack fit. Only viable if the target application is Symfony (5.4/6.x/7.x — confirm the supported matrix, since the notes don't state it). For a Laravel codebase this is a non-starter without an adapter layer, and I would not fund that adapter for a feature this small. Where the stack is Symfony, YAML mapping fits naturally alongside existing config/packages/*.yaml conventions and will feel familiar to the team.
Migration path. Strictly incremental and reversible. Recommended path: leave all existing mappings as-is; pick one low-risk, well-understood DTO mapping and re-express it in YAML as a pilot; verify byte-identical output against the existing implementation with a characterization test; then expand. Do not run a bulk conversion. There is no forced migration here — 2.4.0 is additive, so the correct posture is "adopt where it demonstrably helps," which likely means mappings that change often or that product/ops staff need to read and edit.
Compatibility. Confirm three things before writing any YAML: the minimum PHP version, the supported Symfony versions, and whether the bundle's extension needs explicit registration/configuration to enable YAML discovery. Since the changelog says nothing, treat compatibility as unverified until a spike confirms it in our pinned environment. Also confirm 2.3.1 → 2.4.0 is clean on our lockfile — a minor bump can still shift transitive constraints.
Sequencing.
Maintenance. Net neutral-to-slightly-negative in the near term. The bundle itself is small and the change is small, but YAML mappings add a second source of truth for mapping behaviour. Two formats means contributors must know which one applies to the file they are editing, and reviewers must check both. Mitigate with a hard rule: a given DTO is defined in exactly one format, enforced in review and, if possible, by a CI check.
Support. Support burden shifts rather than shrinks. Fewer "how do I express this in attributes" questions, more "why is my YAML not being picked up" questions — discovery paths, cache state, and indentation are the usual suspects. The absence of upstream documentation means the first-line responder is our own README, so writing it is not optional; it is the deliverable that makes this release usable.
Scaling. YAML mappings scale well organisationally (readable, diffable, editable by people who don't write PHP) and adequately technically. Watch two things as the count grows: parse/resolve cost at container build time, which is real but almost certainly negligible at hundreds of mappings, and cognitive scale — hundreds of YAML files with no schema validation becomes a swamp. The CI lint gate from the integration plan is what keeps this linear.
Failure modes. Ranked by likelihood and impact:
cache:clear part of the deploy as a belt-and-braces measure.Ramp-up. Low for anyone already comfortable with Symfony config — YAML is the format the team already reads daily. The ramp-up cost is not learning YAML; it is the half-day of reverse-engineering the schema from PR #28 and the ongoing cost of owning documentation the upstream project hasn't written. Budget roughly one engineer-week end-to-end for spike, pilot, CI gate, and docs. That is proportionate for an ergonomic improvement, and disproportionate if we attempt a wholesale conversion — which is why the recommendation is deliberate, incremental adoption rather than a migration.
How can I help you explore Laravel packages today?