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-12-20 15:11:19 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