brokeyourbike / json-request-result
Interface and trait for JSON responses
Fund package maintenance!
brokeyourbike
Open Collective
Requires
- php: ^7.4|^8.0
- psr/http-message: ^1.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.4
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-11-20 15:03:45 UTC
README
Interface and trait for JSON responses
Installation
composer require brokeyourbike/json-request-result
Usage
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 | Twitter | LinkedIn | stasi.uk