wendelladriel/laravel-validated-dto
Create Data Transfer Objects that validate input on instantiation. Define rules once and reuse them across controllers, services, jobs, and CLI commands—reducing duplication and keeping validation decoupled from HTTP requests. Compatible with Laravel 11–13.
Adopt if:
Look elsewhere if:
FormRequest suffices.For Executives: "This package lets us write validation rules once and reuse them everywhere—APIs, CLI tools, and background jobs—cutting dev time by 30%+ while improving data consistency. It also bridges PHP and TypeScript teams by auto-generating API contracts, reducing frontend-backend miscommunication. Think of it as standardizing our data ‘language’ across the stack, which scales with our growth."
For Engineers:
*"Instead of copying-pasting validation from Request classes into CLI commands or queues, we’ll define DTOs with validation rules, then reuse them anywhere. Key benefits:
// Old: Duplicate validation in Request and Command
class StoreUserRequest extends FormRequest { ... }
class ProcessUserCommand { ... } // Copies same rules!
With this:
// New: Single source of truth
class UserDTO extends ValidatedDTO {
#[Rule('required|string|max:255')] public string $name;
// ... reuse in API, CLI, or queues
}
```*
**Tradeoff**: Slight learning curve for DTO patterns, but pays off in maintainability."*
How can I help you explore Laravel packages today?