https://github.com/brokeyourbike/data-transfer-object-php
Return original response alongside with the data transfer object
https://github.com/brokeyourbike/data-transfer-object-php
dto dto-entity-mapper dto-pattern hacktoberfest php php8 response
Last synced: about 1 month ago
JSON representation
Return original response alongside with the data transfer object
- Host: GitHub
- URL: https://github.com/brokeyourbike/data-transfer-object-php
- Owner: brokeyourbike
- License: mpl-2.0
- Created: 2021-12-18T19:46:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-20T11:36:14.000Z (about 3 years ago)
- Last Synced: 2025-07-29T00:29:56.773Z (11 months ago)
- Topics: dto, dto-entity-mapper, dto-pattern, hacktoberfest, php, php8, response
- Language: PHP
- Homepage:
- Size: 33.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# data-transfer-object
[](https://github.com/brokeyourbike/data-transfer-object-php/releases)
[](https://packagist.org/packages/brokeyourbike/data-transfer-object)
[](https://codeclimate.com/github/brokeyourbike/data-transfer-object-php/maintainability)
[](https://codeclimate.com/github/brokeyourbike/data-transfer-object-php/test_coverage)
Return original response alongside with the [data transfer object](https://github.com/spatie/data-transfer-object)
## Installation
```bash
composer require brokeyourbike/data-transfer-object
```
## Usage
```php
use BrokeYourBike\DataTransferObject\JsonResponse;
class SomeDTO extends JsonResponse
{
public string $name;
}
assert($response instanceof ResponseInterface);
$dto = new SomeDTO($response);
assert($response === $dto->getRawResponse());
```
## Authors
- [Ivan Stasiuk](https://github.com/brokeyourbike) | [Twitter](https://twitter.com/brokeyourbike) | [LinkedIn](https://www.linkedin.com/in/brokeyourbike) | [stasi.uk](https://stasi.uk)
## License
[Mozilla Public License v2.0](https://github.com/brokeyourbike/data-transfer-object-php/blob/main/LICENSE)