PHP code example of brokeyourbike / data-transfer-object

1. Go to this page and download the library: Download brokeyourbike/data-transfer-object 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/ */

    

brokeyourbike / data-transfer-object example snippets


use BrokeYourBike\DataTransferObject\JsonResponse;

class SomeDTO extends JsonResponse
{
    public string $name;
}

assert($response instanceof ResponseInterface);

$dto = new SomeDTO($response);

assert($response === $dto->getRawResponse());