- Can I use json-mapper/symfony-bundle in a Laravel application?
- No. json-mapper/symfony-bundle is Symfony DependencyInjection glue: a Bundle subclass, service definitions, and a configuration tree, none of which execute under Laravel's container. It also pulls symfony/http-kernel and symfony/dependency-injection transitively. For Laravel, use the framework-agnostic json-mapper/json-mapper core library and wire it yourself.
- What is the Laravel equivalent of the bundle's service integration?
- Register a singleton JsonMapper in a Laravel service provider using JsonMapperBuilder, then bind JsonMapperInterface to that instance with an alias. Move any middleware list and class-map configuration into a config/json-mapper.php file. That is roughly 30 to 50 lines and gives you the same container-injection pattern the Symfony bundle provides.
- How do I install and configure json-mapper in a Laravel app?
- Require json-mapper/json-mapper, not the Symfony bundle. Create a service provider that builds and binds the mapper singleton, add a config file for middlewares and mappings, and inject the interface into controllers, jobs, or actions. Do not add json-mapper/symfony-bundle to a Laravel composer.json.
- Does json-mapper support Laravel 10 and 11 on PHP 8.1 and 8.2?
- The core json-mapper library is framework-agnostic and uses attribute-based mapping, which fits Laravel 10 and 11 on PHP 8.1 and 8.2. Confirm the latest core release supports your exact PHP target before committing. The Symfony bundle's own Symfony version constraints are irrelevant to a Laravel install because you should not install it.
- Does json-mapper validate JSON, or should I use Laravel validation?
- No. json-mapper hydrates JSON into typed PHP objects; it does not validate JSON against a schema or produce Laravel validation errors. Use FormRequests, the Validator facade, or a JSON Schema library first, then map the validated payload into a DTO. Treat validation and hydration as separate steps in the request lifecycle.
- Is json-mapper/symfony-bundle affected by CVE-2022-24894?
- Release 2.2.1, the only release in the review window, bumped a Symfony http-kernel constraint to resolve CVE-2022-24894, an HTTP-cache advisory. It did not change the bundle's own code or API. Installing the bundle means inheriting Symfony's CVE cadence alongside it, which the core-library-only approach avoids. If any lockfile still references the bundle, audit it against that advisory.
- What alternatives to json-mapper should Laravel developers evaluate?
- Consider spatie/laravel-data for attribute-driven DTOs with built-in validation, symfony/serializer if you need a mature serializer, or plain FormRequests and validated arrays for simple cases. Choose based on whether schema validation is in scope and how much bespoke mapping glue you can maintain. json-mapper is a reasonable fit when you want explicit DTO hydration without a larger framework.
- How do I migrate from a Symfony service using JsonMapperInterface to Laravel?
- Lift the middleware list and any class-map configuration out of Symfony YAML or XML into config/json-mapper.php. Instantiate JsonMapper with JsonMapperBuilder in a Laravel service provider and bind JsonMapperInterface to that singleton. Consumers keep injecting the interface, so call-site changes are near zero. The bundle's architectural contribution is just a configured singleton plus interface binding.
- Does json-mapper support DateTime handling, case conversion, and null handling?
- Yes, through middlewares in the core library's configuration, such as DateTime handling, case conversion, and null handling. The Symfony bundle exposes these through its configuration tree, but the middleware list itself is portable. Express the equivalent settings in a Laravel config file and pass them to JsonMapperBuilder. Confirm each middleware is available in the core version you install.
- Is json-mapper/symfony-bundle actively maintained, and should I depend on it?
- Treat it as a read-only reference for DI wiring, not an installable dependency. The repo has zero stars and zero dependents, and its only release in the review window was dependency hygiene rather than feature development. The core json-mapper library carries the substantive risk: attribute-based reflection couples DTO annotations to JSON shape, so drift surfaces as runtime MappingException rather than at compile or validation time. Track core releases and add mapping tests around payload changes.