PHP code example of nandan108 / dto-toolkit

1. Go to this page and download the library: Download nandan108/dto-toolkit 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/ */

    

nandan108 / dto-toolkit example snippets


use Nandan108\DtoToolkit\Core\{FullDto, CastTo};

// FullDto blic ?string $name = null;
}

final class MyEntity
{
    public ?string $name = null;
}

// Build DTO from array
$dto = MyDto::newFromArray(['name' => '  Alice  ']);

// Transform into an entity (optionally recursive)
$entity = $dto->exportToEntity(MyEntity::class, recursive: true);