Skip to content

Return original response alongside with the data transfer object

License

Notifications You must be signed in to change notification settings

brokeyourbike/data-transfer-object-php

Repository files navigation

data-transfer-object

Latest Stable Version Total Downloads Maintainability Test Coverage

Return original response alongside with the data transfer object

Installation

composer require brokeyourbike/data-transfer-object

Usage

use BrokeYourBike\DataTransferObject\JsonResponse;

class SomeDTO extends JsonResponse
{
    public string $name;
}

assert($response instanceof ResponseInterface);

$dto = new SomeDTO($response);

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

Authors

License

Mozilla Public License v2.0