Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Request Dto Resolver Laravel Package

macpaw/request-dto-resolver

macpaw/request-dto-resolver automatically maps incoming Laravel request data into typed DTOs, cutting boilerplate and keeping controllers clean. It resolves DTO constructor parameters, supports nested objects, and makes request handling more explicit, predictable, and easy to test.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

What it is. macpaw/request-dto-resolver is a Symfony bundle, not a Laravel package. It adds a request value-resolver that maps HTTP request data (route params, query string, body) into typed DTO objects declared as controller action arguments, removing hand-written $request->get(...) hydration and pushing type coercion/validation into the framework's argument-resolution phase. The first decision a TPM must make is whether the target application is actually Symfony — because the framing here ("Laravel/PHP package") does not match the artifact.

Current release status (v1.1.2). A patch release containing a single functional change: restore route attribute lookup for DTO parameter resolution. This is non-breaking — no new features, no deprecations, no API changes. Two implications matter for a TPM: (a) upstream is actively maintained and regressions are turned around quickly, which modestly improves the continuity picture; (b) a regression in a core resolution path (route-attribute-bound DTOs) escaped into the 1.1.x line, which confirms that upstream's own test coverage of resolution paths is not a sufficient safety net for adopters. The practical output is a version floor of 1.1.2 and stronger justification for the contract-test gate already recommended below.

Architecture fit.

  • Symfony application: good conceptual fit. It plugs into the ArgumentResolver/ValueResolver pipeline, which is the idiomatic extension point. Integration is a bundle registration plus DTO classes; there is no service, database, or middleware to operate.
  • Laravel application: poor fit without a bridge. Laravel does not use Symfony's HttpKernel argument resolvers for controller actions; it uses its own container-based method injection and route-model binding. Making this work under Laravel means reimplementing the resolution step inside a service provider or a custom Route/controller dispatcher, at which point you have adopted a dependency for its DTO semantics rather than its integration.
  • Hybrid/transitional estates (Symfony app with shared PHP libraries, or a Laravel→Symfony migration in progress): the only scenario where cross-framework reuse is plausible.

Integration feasibility. Mechanically simple in Symfony: composer require, register the bundle, add a DTO type-hint to a controller signature. There is no infrastructure footprint — the repo's own agent notes confirm there are no runtime services, databases, or web servers, only CLI tooling. The real effort is not installation; it is deciding the contract for mapping, validation, and error responses, which this package influences but does not fully own.

Technical risk.

  1. Ecosystem mismatch (highest). A Symfony bundle cannot be dropped into Laravel. If the requester's stack is Laravel, the effective work is a port, not an integration.
  2. Maturity and validation gap. 1 star and 0 dependents means zero external production validation. Upstream is responsive (v1.1.2 landed as a targeted fix), but the 1.1.1 regression in route-attribute resolution demonstrates that core-path correctness is not guaranteed by upstream CI alone. Treat the public API as stable-in-intent, unproven-in-practice.
  3. Bus factor / governance. A small-vendor OSS project (MacPaw) with minimal adoption has no published support commitment. v1.1.2 shows two named contributors active, which is an improvement over single-maintainer risk, but no formal continuity commitment exists. Continuity is a procurement question, not just an engineering one.
  4. Implicit mapping is a mass-assignment surface. Auto-binding request payloads to DTO properties is convenient and dangerous: without an explicit allow-list, a client can populate fields the endpoint never intended to expose. This must be a design review gate, not a code-review afterthought.
  5. Error semantics are underspecified. Type coercion failures, missing required fields, and validation errors must map deterministically to 400 vs 422, and must not leak stack traces. If the package throws raw deserialization exceptions, you inherit a 500-heavy failure mode.
  6. Resolution-path coverage is now a known weak spot. The 1.1.1→1.1.2 fix implies at least one source of DTO parameters (route attributes) behaved differently across a patch boundary. Verify which sources — route attributes, query, body, headers — are exercised by upstream tests before trusting any of them.
  7. Reflection/metadata cost. Resolution is reflection-driven; without metadata caching it adds per-request overhead. Usually negligible against I/O, but worth measuring on hot endpoints.
  8. Reproducibility. No committed composer.lock is correct for a library, but it means composer install resolves fresh dependency versions — CI can break on an unrelated Symfony minor release.

Key questions to resolve before adoption.

  • Is the target application Symfony, Laravel, or both? (Everything downstream hinges on this.)
  • Which Symfony/PHP version constraints does it declare, and does that match our LTS/support window?
  • Does it integrate with Symfony Validator and Serializer, or does it ship its own coercion rules?
  • How are nested objects, arrays-of-DTOs, and enums handled? What is the failure behavior at each?
  • Is property population allow-list based or attribute-driven by default?
  • Which parameter sources (route attribute, query, body) are covered by upstream tests, and how are regressions like the 1.1.1 route-lookup issue caught?
  • Who owns this internally if upstream goes quiet — do we have a fork strategy and a named maintainer?

Integration Approach

Stack fit. Treat this as a Symfony-native component. Confirm PHP version floor and Symfony major (6.x/7.x) alignment against the application's composer.json before anything else. For a Laravel codebase, the honest comparison set is native FormRequest + a data-object library (e.g., spatie/laravel-data), not this bundle — the cost/benefit favors the native path unless there is a concrete reason to standardize on Symfony's resolver contract across services.

Migration path.

  • Greenfield Symfony service: direct adoption, low friction.
  • Existing Symfony controllers: incremental — convert one controller action at a time; resolved DTOs and legacy Request injection coexist without conflict. Include at least one route-attribute-bound DTO in the first batch, since that path is the most recently demonstrated to be fragile.
  • Laravel: do not adopt directly. Either (a) standardize on a Laravel-native DTO approach, or (b) if a shared DTO contract across Symfony and Laravel services is the actual goal, define an internal RequestDtoFactory interface and implement it twice — once wrapping this bundle, once wrapping the Laravel equivalent. That abstraction is the migration insurance policy.
  • Cross-framework: isolate behind the interface above so the package is an implementation detail, swappable without touching controllers.

Compatibility. Set the constraint floor at ^1.1.2 and explicitly exclude 1.1.0/1.1.1 if route-attribute-bound DTOs are in scope. Verify: declared Symfony component constraints, PHP version, interaction with the application's serializer/validator configuration (custom normalizers, validation groups, DateTimeInterface handling), and behavior under the framework's error handler. The absence of a lock file means pinning exact versions in the consuming application and running the library's own composer phpstan / composer phpunit gates in a canary build before bumping.

Sequencing.

  1. Spike: one non-critical endpoint, DTO with scalars, nested object, enum, and a validation rule — plus one DTO bound from route attributes — measure behavior on malformed input.
  2. Decide the error contract (status codes, payload shape) and whether the package or our code owns it.
  3. Define the allow-list/security policy for property population and codify it in review guidelines.
  4. Wrap behind an internal abstraction; add contract tests that assert resolution behavior independent of the library, one case per parameter source.
  5. Roll out by bounded context; keep the legacy path available until the abstraction is proven.
  6. Only then evaluate a fork if upstream cadence is insufficient — noting that a fork would now need to track upstream's fix cadence, which the 1.1.2 release shows is at least occasionally faster than our own patch cycle.

Operational Impact

Maintenance. No runtime footprint — nothing to deploy, monitor, or page on. The maintenance burden is dependency hygiene: watching an upstream repo with 1 star and no dependents means you are the de facto QA. v1.1.2 is a positive data point (a regression was diagnosed and shipped quickly), but it is one data point; budget a named internal owner, a pinned version policy, and a periodic upstream review. A vendor fork remains a reasonable contingency given the project's size; the codebase is small enough that forking is cheap.

Support. Community-only, no SLA, no commercial backing evident. Escalation path is "read the source" and, increasingly, "watch the releases page" — upstream responsiveness is demonstrated but not contractual. For a low-criticality, request-hydration concern this is acceptable; for anything on a regulated or high-availability path, it needs an internal owner and a documented fallback (hand-written hydrators).

Scaling. Per-request CPU cost is small and constant; the resolver runs once per action and does not affect horizontal scaling, connection pools, or queue throughput. Confirm metadata/reflection caching is enabled so cost does not scale with DTO complexity. The realistic scaling concern is organizational: as more endpoints adopt the pattern, consistency of DTO design and validation rules becomes the bottleneck, not the library.

Failure modes to design for.

  • Silent loss of a parameter source after a version change — the exact shape of the 1.1.1 regression: route-attribute-bound DTO parameters stopped resolving, fixed in 1.1.2. Pin the floor and assert each source in CI.
  • Misconfigured DTO (unsupported type, unresolvable nested class) → framework-level exception, likely a 500 on an otherwise valid route. Needs a startup/CI contract test per DTO.
  • Malformed client input → raw coercion exception instead of a clean 422. Must be intercepted.
  • Partial/empty DTO population silently succeeding → endpoints operating on default values. Assert required fields explicitly.
  • Over-posting via unmapped properties → security exposure. Enforce allow-listing.
  • Deeply nested or oversized payloads → recursion/limit behavior unverified.
  • Dependency drift after a composer update → behavior change with no changelog signal.

Ramp-up. For Symfony developers: hours. The concepts (DTO, value resolver, validation) are standard. For Laravel-only teams: the ramp-up is not the library, it is the Symfony mental model — days, plus the bridge work, which is where the real cost sits. Either way, invest in two artifacts before broad rollout: a short internal style guide for DTO design (types, nullability, validation placement) and a set of contract tests that pin the request-to-DTO behavior so a future swap or fork is verifiable rather than hopeful. The v1.1.2 release is the argument for those contract tests, not against them.

TPM recommendation. Viable and low-risk if and only if the target is Symfony. The 1.1.2 patch is reassuring on maintenance velocity and neutral on architecture; it does not change the decision, but it does set a hard version floor (^1.1.2) and sharpen the case for per-parameter-source contract tests. Under Laravel, the adoption cost exceeds the benefit and a native approach is the better product decision. Regardless of path, gate adoption behind the internal abstraction, an explicit security policy for property population, and a defined error contract — those three decisions matter more than the library itself.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib