Download the PHP package php-collective/symfony-dto without Composer
On this page you can find all versions of the php package php-collective/symfony-dto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download php-collective/symfony-dto
More information about php-collective/symfony-dto
Files in php-collective/symfony-dto
Package symfony-dto
Short Description Symfony integration for php-collective/dto
License MIT
Informations about the package symfony-dto
Symfony DTO Bundle
Symfony bundle integration for php-collective/dto.
Installation
The bundle will be auto-configured if you're using Symfony Flex.
Manual Registration
If not using Flex, add to config/bundles.php:
Configuration
Create config/packages/php_collective_dto.yaml:
Usage
1. Initialize DTO configuration
This creates a config/dto.php file with a sample DTO definition (PHP format is the default).
You can also use --format=xml or --format=yaml.
The generated config looks like:
2. Generate DTOs
Options:
--dry-run- Preview changes without writing files--config-path- Override config path--output-path- Override output path--namespace- Override namespace-v- Verbose output
3. Generate TypeScript interfaces
4. Generate JSON Schema
5. Use your DTOs
DTO Mapping Helpers
JSON Response Helper
Controller DTO Resolution
When enable_value_resolver is enabled, you can use #[MapRequestDto] to map request data to DTOs:
The source option controls where data comes from: body, query, request, or auto.
Collections
The bundle automatically registers Doctrine's ArrayCollection for DTO collection fields. Define collection fields with the [] suffix:
After generating, collection fields use Doctrine's ArrayCollection class with its methods (filter, map, first, etc.).
Validation Bridge
Automatically convert DTO validation rules to Symfony Validator constraints:
See Usage docs for details.
AutoMapper Bridge
For automatic entity-to-DTO mapping without manual field assignment, install the optional AutoMapper integration:
Then use DtoAutoMapperInterface in your services:
See Usage docs for full documentation including bidirectional mapping.
Supported Config Formats
The bundle supports multiple config file formats:
dto.php- PHP format (default)dto.xml- XML formatdto.yml/dto.yaml- YAML formatdto/subdirectory with multiple files
License
MIT
All versions of symfony-dto with dependencies
doctrine/collections Version ^2.0
php-collective/dto Version ^0.1.12
symfony/console Version ^7.0|^8.0
symfony/framework-bundle Version ^7.0|^8.0