- How do I install sbsedv/input-converter-bundle?
- Install it with Composer using composer require sbsedv/input-converter-bundle. If Symfony Flex does not enable it automatically, register the bundle in config/bundles.php. Then configure the converters you need according to the README. The package metadata requires Symfony ^6.1.
- What Symfony versions does input-converter-bundle support?
- The package is described as a Symfony ^6.1 bundle, so Symfony 6.1 and later 6.x releases are the intended target. The provided context does not confirm Symfony 5.x or Symfony 7.x support. Check the composer.json constraints and test your Symfony version before upgrading.
- How does this bundle map request data to DTOs?
- It uses configurable converters to turn query parameters, body input, and route parameters into typed PHP objects. Instead of hand-parsing arrays in controllers, you define the DTO mapping and let the converter handle input conversion. The exact converter configuration is documented in the README.
- How do I get the raw request body from InputBag with this bundle?
- The bundle adds the raw request body input to Symfony's http-foundation InputBag. That lets you read the raw payload alongside normal request input instead of manually pulling php://input. Refer to the README for the exact accessor and configuration details.
- Can I map JSON request bodies to PHP objects?
- Yes, the bundle's purpose is converting raw request input into typed PHP objects. Body input, including raw request body data, can be mapped through the configured converters. It focuses on conversion, so you should still validate the resulting DTO separately.
- Is sbsedv/input-converter-bundle compatible with Laravel?
- No, this is a Symfony bundle built for Symfony ^6.1 and Symfony's http-foundation and bundle system. Laravel uses a different request lifecycle and container, so this package is not intended for Laravel applications. In Laravel, look at form requests, DTO casting, or packages such as spatie/laravel-data instead.
- How do I validate DTOs after input conversion?
- The bundle handles input conversion, not validation rules. After conversion, run Symfony Validator against the DTO or add constraints to DTO properties. Then handle validation failures in your controller or a shared exception listener.
- How do I test controllers that use input converters?
- Use Symfony's WebTestCase or KernelTestCase to send requests with query, body, and route parameters. Assert the response and, where useful, the converted DTO state. You can also unit test converters directly by passing representative request input, which keeps input handling consistent and testable.
- What are alternatives to input-converter-bundle?
- Symfony 6.3+ provides MapRequestPayload and MapQueryString for attribute-based DTO mapping. You can also use a custom ArgumentResolver, Symfony Form, or a manual request-to-DTO mapper. Choose based on your Symfony version and whether you need raw body input added to InputBag.
- Is input-converter-bundle production-ready and maintained?
- Check the GitHub repository for recent commits, releases, and open issues before adopting it in production. Pin a tested Composer version and verify behavior in staging. The provided context does not include a maintenance cadence or long-term support guarantee.