php-collective/dto
php-collective/dto is a lightweight PHP package for defining typed data transfer objects. Hydrate DTOs from arrays or Laravel requests, cast nested DTOs and collections, validate data, and keep application boundaries clean with simple, expressive classes.
Recommendation: Conditional pilot remains appropriate, with an added gate for generated-code behavior. Release 0.1.20 materially improves the assessment by confirming a canonical repository (php-collective/dto) and changelog, fixing a TransformerRegistry bypass in generated hydration, and optimizing field transforms in the generated fast path. Those are positive signals, but they also confirm that the package has generated code, global registry semantics, input/output transform scoping, and dual execution paths—areas that require contract testing before broader adoption.
TransformerRegistry casters for input and serializers for output, plus transformFrom / transformTo field transforms. That fits “normalize at the edge, pass typed objects inward,” but teams should avoid turning global registry configuration into hidden business logic. Generated fast-path hydration also means DTO behavior is partly build-time generated, not just runtime reflection.fromArray() / toJson() usage remain straightforward. The new release adds integration details to verify: generated files must be produced and refreshed correctly; strictTypes affects whether transforms are compiled into direct calls; unsafe or unresolvable callables fall back to the runtime path; and globally registered TransformerRegistry casters must apply consistently during generated fromArray() hydration. This is feasible but requires explicit build/cache and parity testing.0.1.20 fixes a bug where generated fast-path hydration bypassed globally registered TransformerRegistry casters, and it scopes guards so casters affect input while serializers affect output. That fix is welcome, but it demonstrates that generated and runtime paths can diverge. Additional risks include stale generated artifacts, strictTypes-dependent behavior, callable resolution differences, global registry coupling, and asymmetric input/output transforms.php-collective/dto?0.1.20?strictTypes versus when they do not?TransformerRegistry casters registered, scoped, and isolated between input hydration and output serialization?fromArray() and toArray() / toJson() symmetric for enums, dates, nulls, absent keys, nested DTOs, and collections?0.1.x releases?TransformerRegistry casters and transformFrom / transformTo sparingly and locally; avoid a broad global registry of app-specific transforms unless ownership and scoping are clear. Keep Eloquent models and domain entities separate. Treat generated fast-path code as a build concern, not as application code to hand-edit.0.1.19 to 0.1.20 outputs for representative payloads. Introduce or retain an internal wrapper around DTO hydration and serialization so application code depends on our conventions, not directly on every package API. Add contract tests that run both generated fast-path and runtime fallback cases, especially where TransformerRegistry, transformFrom, transformTo, and strictTypes are involved. Pilot in one bounded context behind a feature flag.0.1.20 and verify the PHP/Laravel support matrix. Run PHPUnit, PHPStan/Larastan, queue serialization, and Laravel request/resource tests. Regenerate fast-path files in CI and assert they are current. Test enum/date formats, nullable semantics, nested collections, registry casters, input-only versus output-only guards, and unsafe callable fallback. Treat Laravel validation as the source of truth; the package’s transforms should not replace validation.php-collective/dto repository: maintainers, CI, coverage, security policy, and release discipline.0.1.20 registry fix.TransformerRegistry configuration as deployable artifacts requiring review, regeneration, and cache invalidation. Monitor upstream releases and security advisories; the canonical repository is now clearer, but community support and bus factor still warrant a fork-readiness plan. Avoid spreading package-specific transform APIs across the codebase.0.1.20 fixes a fast-path registry bypass, support procedures should include a parity check after every package upgrade. The wrapper layer and contract tests remain the real support mechanism.TransformerRegistry bypass recurrence, input casters leaking into output serialization, output serializers affecting input hydration, unresolvable transform callables, strictTypes-dependent behavior, stale generated files, silent scalar coercion, absent-vs-null confusion, enum/date parse errors, nested DTO type mismatches, collection item-type drift, recursion on cyclic structures, and asymmetric toArray() / fromArray() behavior. Mitigate with strict fixtures, generated-file CI checks, explicit error handling, payload schema/version markers, and alerting on hydration failure rates.strictTypes implications, transform callable conventions, and TransformerRegistry scoping. Plan a short internal guide and code-review checklist covering nullability, naming, nested collections, validation boundaries, transforms, generated artifacts, and error handling. Expect roughly half a day to one day per developer for basic proficiency, plus one sprint to establish team-wide conventions and parity tests.How can I help you explore Laravel packages today?