- What does shokhaa/reuqest-resolver-bundle actually do in a Laravel application?
- It turns incoming HTTP request data into explicit, reusable values by running the payload through pluggable request resolvers. Instead of parsing input in every controller, you centralise the mapping in one place. Controllers and services then receive typed values and stay focused on application logic.
- How do I install shokhaa/reuqest-resolver-bundle?
- Install it with Composer using composer require shokhaa/reuqest-resolver-bundle. The package integrates with Laravel through package discovery, so its service provider is registered automatically and you normally do not need to edit config/app.php. If you have disabled discovery in your application, register the provider manually.
- How does this package keep controllers thin?
- Controllers receive already-resolved values instead of reaching into the request and parsing fields themselves. All mapping rules live in resolvers, so the same input handling is reused consistently across endpoints. The result is less duplicated code and controllers that only orchestrate application logic.
- How do I create a custom request resolver?
- A resolver maps an incoming payload to a typed object or value and is registered with the package, which applies it when the relevant request is handled. Start by implementing the resolution rule your endpoint needs, then register it so it is picked up automatically. Because the structure is extensible, you can keep each resolver small and single-purpose.
- Does shokhaa/reuqest-resolver-bundle replace Laravel FormRequest validation?
- No. The package focuses on resolving request data into explicit values, while validation remains the job of Laravel's validator or FormRequest classes. In practice you validate first and then resolve the validated payload into a typed object. Keeping both concerns separate makes each one easier to test and change.
- Can I use it for JSON API endpoints as well as standard form submissions?
- Yes. Resolvers work on incoming HTTP request data, so the same approach applies to form posts and JSON payloads. You map just the fields you need from the request into explicit values, which keeps API controllers consistent with the rest of the application.
- Which Laravel versions does shokhaa/reuqest-resolver-bundle support?
- The package targets Laravel applications and relies on package discovery, so it works on framework versions that support auto-discovery. Check the composer.json constraints in the repository for the exact PHP and Laravel versions that are tested. Pinning a known-good version in your own composer.json is the safest way to stay compatible.
- How do I test request resolvers in my Laravel application?
- Because resolvers are plain classes, you can unit test them directly by passing sample payloads and asserting the resolved output. For end-to-end confidence, add feature tests that call your routes and assert the controller receives the expected values. Testing resolvers in isolation keeps the suite fast and independent of the HTTP layer.
- Is this package production ready and actively maintained?
- It is a lightweight package with a deliberately narrow scope, which lowers the risk of unexpected breakage in production. Review the repository's release history and commit activity before adopting it, and pin the version in composer.json. If your application depends on it heavily, consider wrapping your resolvers so a future swap stays cheap.
- What are the alternatives to using a request resolver package?
- Laravel FormRequest classes and manual DTO mapping cover much of the same ground, and DTO packages such as spatie/laravel-data offer a broader feature set. This bundle fits best when you want a small, focused layer that maps payloads to explicit values without extra dependencies. Compare each option against how much request-mapping logic your endpoints actually carry.