codememory/dto
Auto-hydrate PHP/Symfony DTOs from request/array data using rules and decorators. Supports name conversion (e.g., snake_case), enum casting via attributes, and event hooks during processing. Build a manager with caching and reflection for fast mapping.
spatie/laravel-data for Laravel-native DTOs."This package lets us standardize how data flows into our PHP/Laravel services—automatically converting inputs to typed objects (e.g., enums, validated strings) with zero manual mapping. It’s like a ‘smart parser’ for APIs or forms, reducing bugs from invalid data while keeping our code clean. Think of it as a safety net for our backend: no more runtime errors from malformed inputs. The Symfony integration aligns with our validation stack, and the event system lets us plug in custom rules later. It’s a lightweight investment to future-proof our data layer."
*"codememory/dto gives us a battle-tested way to handle DTOs with:
@Assert annotations).Tradeoffs:
Use cases:
Alternatives: If we’re Laravel-only, spatie/laravel-data might be simpler. But this gives us more control for Symfony-heavy stacks."*
How can I help you explore Laravel packages today?