PHP code example of dualmedia / symfony-request-dto-bundle

1. Go to this page and download the library: Download dualmedia/symfony-request-dto-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dualmedia / symfony-request-dto-bundle example snippets


return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    // other bundles ...
    DualMedia\DtoRequestBundle\DtoBundle::class => ['all' => true],
];

use DualMedia\DtoRequestBundle\Dto\AbstractDto;
use DualMedia\DtoRequestBundle\Dto\Attribute\Bag;
use DualMedia\DtoRequestBundle\Metadata\Enum\BagEnum;
use Symfony\Component\HttpFoundation\File\UploadedFile;

// input:
// [
//     'name' => 'John',
//     'age' => '25',
//     'score' => '9.5',
//     'active' => '1',
//     'avatar' => <UploadedFile>,
// ]

class ProfileDto extends AbstractDto
{
    public string|null $name = null;

    public int|null $age = null;

    public float|null $score = null;

    public bool|null $active = null;

    #[Bag(BagEnum::Files)]
    public UploadedFile|null $avatar = null;
}