symfonyvalue-objects-and-dtos
Design Value Objects for domain concepts and DTOs for data transfer with proper immutability and validation
When & Why to Use This Skill
This Claude skill streamlines the development of robust Symfony applications by designing immutable Value Objects and Data Transfer Objects (DTOs). It focuses on implementing Domain-Driven Design (DDD) principles, ensuring strict type safety, and enforcing data validation to improve code maintainability and reduce architectural technical debt in PHP projects.
Use Cases
- Domain Modeling: Creating immutable Value Objects to represent core business concepts such as Email, Money, or Address, ensuring they are always in a valid state.
- API Data Transfer: Designing DTOs to structure and validate incoming request payloads from RESTful APIs or forms before they reach the service layer.
- Refactoring: Modernizing legacy Symfony codebases by replacing 'primitive obsession' (using arrays or strings for complex data) with structured, type-hinted objects.
- Data Integrity: Implementing complex validation rules within DTO constructors to catch data inconsistencies early in the application lifecycle.
| name | symfony:value-objects-and-dtos |
|---|---|
| description | Use when symfony value objects and dtos |
symfony:value-objects-and-dtos (Micro)
Use when
- Use when symfony value objects and dtos
Rules
- Keep changes minimal and focused
- Ask before running servers/builds/tests
- Load reference/examples only on explicit request
References
reference.mddocs/complexity-tiers.md