json-mapper/symfony-bundle
Symfony bundle that integrates JSON Mapper into your Symfony application, providing service configuration and dependency injection for mapping JSON data to PHP objects. Simplifies setup so you can configure mappers and use them via the container.
Architecture fit. This package is a Symfony bundle, not a Laravel package. Its entire surface area is Symfony DependencyInjection glue: a Bundle subclass, service definitions wiring JsonMapperInterface to a configured JsonMapper instance, and configuration tree handling for middlewares. None of that executes under Laravel's container. For a Laravel stack, the relevant artifact is the underlying json-mapper/json-mapper core library, which is framework-agnostic and usable directly. The bundle is best treated as a reference implementation of the DI wiring pattern, not as an installable dependency.
Integration feasibility. Low for the bundle itself (incompatible container, pulls symfony/http-kernel and symfony/dependency-injection transitively). High for the core library: registering a singleton JsonMapper in a Laravel service provider and binding an interface alias is roughly 30–50 lines. The real integration work is not code, it is convention-setting: which DTOs are mappable, how attributes are declared, and where mapping happens in the request/response lifecycle.
Technical risk. Mixed but manageable. Release 2.2.1 (2023-04-04) is the only release in the review window and it is a transitive-dependency security constraint bump resolving CVE-2022-24894 (a Symfony http-kernel/HTTP-cache advisory). There is no API change, no configuration change, no new feature, and no deprecation — the bundle's own code is untouched. It therefore does not change the recommendation, and it clarifies the earlier read: the repo's sole maintenance activity since 2023 has been dependency hygiene, not development. Two secondary signals follow. First, the bundle carries its own inherited vulnerability surface — installing it means inheriting Symfony's CVE cadence alongside it, which the core-library-only approach avoids entirely. Second, responsiveness is modest: the upstream advisory was patched in Symfony in early 2023 and the constraint bump landed roughly two months later, in a repo with zero stars and zero dependents. Fine for a read-only reference, a red flag if it were ever a dependency. The core library still carries the substantive risk: attribute-based reflection mapping is a schema-coupling point, and any drift between JSON payload shape and DTO annotations surfaces as runtime MappingException rather than at compile or validation time.
Key questions before committing.
json-mapper/json-mapper library actively released, and does it support the PHP version on our deployment target?spatie/laravel-data, symfony/serializer, or plain Laravel FormRequests already cover the use case with less bespoke glue?composer.json today, left over from a port or a PoC? If so, that lockfile needs an audit against this CVE before anything else happens.Stack fit. Use the core library; do not install the Symfony bundle. Laravel 10/11 on PHP 8.1/8.2 aligns with the attribute-based mapping model. The bundle's architectural contribution — a configured singleton plus interface binding — translates cleanly to a Laravel service provider.
Migration path. If porting from a Symfony service that already consumes JsonMapperInterface: lift the middleware list and any class-map configuration out of Symfony YAML/XML into a config/json-mapper.php file, instantiate JsonMapper via JsonMapperBuilder in the provider, and bind the interface to that singleton. Consumers keep injecting the interface, so call-site churn is near zero. If starting fresh, skip the port entirely and write the provider against the core API. For teams using the bundle as a reference implementation, note that 2.2.1 narrows its symfony/* constraints to patched versions — copy the wiring pattern, not the composer.json.
Compatibility. Watch three boundaries: PHP version floor of the core library, the symfony/* constraint set if anything else in the app pulls Symfony components (console, process), and attribute support in the runtime. Because the bundle will not be installed, its Symfony constraints — now stricter after 2.2.1 — cannot poison the dependency graph. That remains a deliberate benefit of the core-only approach.
Sequencing.
Maintenance. You own the glue — a small provider, a config file, and convention docs. Budget a few days initially and a low recurring cost. The dependency to monitor is the core library, not this bundle; pin it and review on PHP upgrades since reflection-and-attributes libraries are sensitive to language changes. Do not depend on the bundle for updates: 2.2.1 is a dependency-hygiene patch, not evidence of feature maintenance, and should not be read as a renewal of upstream investment.
Support. No vendor, no SLA, GitHub-issues-only. Realistic expectation is self-support with upstream fixes arriving only if the core maintainers care about the issue. Security posture is constraint-bump-only — there is no indication of backports to older branches — so anyone who did install the bundle must track latest. For a low-criticality mapping layer this is acceptable; for a payment or compliance boundary it is not.
Scaling. Mapping is CPU-bound reflection. At high throughput (bulk imports, high-QPS ingestion), metadata reflection becomes measurable, so plan to cache mapper metadata or reuse a single mapper instance rather than constructing per call. Memory profile is fine; the risk is latency under volume, not footprint.
Failure modes.
MappingException or silently null DTO properties. Decide explicitly between strict failure and lenient defaults.null, and boolean-ish values are classic mismatch sources; codify expected behavior in tests.symfony/http-kernel floor becomes a security concern, not just a conflict concern. Verify the patched constraint range in any environment where it already exists.Ramp-up. Low for engineers familiar with attributes and DTO patterns; a half-day of onboarding plus one worked example is typically enough. The larger organizational cost is convention discipline — without a documented DTO standard, teams will invent inconsistent mapping styles and the error surface will fragment. Given the package's near-zero adoption signals and patch-only release history, position this as an internal, self-owned utility layer built on a small upstream library, not as a community-supported dependency.
How can I help you explore Laravel packages today?