Return original response alongside with the data transfer object
composer require brokeyourbike/data-transfer-object
use BrokeYourBike\DataTransferObject\JsonResponse;
class SomeDTO extends JsonResponse
{
public string $name;
}
assert($response instanceof ResponseInterface);
$dto = new SomeDTO($response);
assert($response === $dto->getRawResponse());
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk