https://github.com/brokeyourbike/json-request-result-php
Interface and trait for JSON responses
https://github.com/brokeyourbike/json-request-result-php
hacktoberfest json json-decoding php php8
Last synced: 7 months ago
JSON representation
Interface and trait for JSON responses
- Host: GitHub
- URL: https://github.com/brokeyourbike/json-request-result-php
- Owner: brokeyourbike
- License: mpl-2.0
- Created: 2021-10-19T13:17:08.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-20T11:41:07.000Z (over 2 years ago)
- Last Synced: 2025-06-01T15:51:24.124Z (7 months ago)
- Topics: hacktoberfest, json, json-decoding, php, php8
- Language: PHP
- Homepage:
- Size: 32.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
# json-request-result
[](https://github.com/brokeyourbike/json-request-result-php/releases)
[](https://packagist.org/packages/brokeyourbike/json-request-result)
[](https://codeclimate.com/github/brokeyourbike/json-request-result-php/maintainability)
[](https://codeclimate.com/github/brokeyourbike/json-request-result-php/test_coverage)
Interface and trait for JSON responses
## Installation
```bash
composer require brokeyourbike/json-request-result
```
## Usage
```php
use Psr\Http\Message\ResponseInterface;
use BrokeYourBike\JsonRequestResult\JsonRequestResultTrait;
use BrokeYourBike\JsonRequestResult\JsonRequestResultInterface;
class Result implements JsonRequestResultInterface
{
use JsonRequestResultTrait;
public function __construct(ResponseInterface $response)
{
$this->statusCode = $response->getStatusCode();
$this->responseBody = (string) $response->getBody();
}
}
```
## 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/json-request-result-php/blob/main/LICENSE)