brokeyourbike/json-request-result

Interface and trait for JSON responses

1.0.2 2023-05-14 22:06 UTC

This package is auto-updated.

Last update: 2024-09-20 14:37:36 UTC


README

Latest Stable Version Total Downloads Maintainability Test Coverage

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

License

Mozilla Public License v2.0