symbiotic/http-response-mutable

Mutable response, the decorator is made to work with the response object via a Psr container

1.4.0 2022-09-11 02:31 UTC

This package is auto-updated.

Last update: 2024-10-11 07:06:31 UTC


README

Warning

Widespread use of this decorator is not recommended! We use it to transfer it to controllers via a DI container.

Features

  • Compatible with PSR-7 (Http Message)
  • Simple class
  • php 7.2+

Installation

composer require symbiotic/http-response-mutable 

Usage

Mutable response, the decorator is made to work with the response object via a Psr container.

/**
 * @var  \Psr\Http\Message\ResponseInterface $response
 **/
$response = $psr_response_instance;

$responseMutable  = new Symbiotic\Http\ResponseMutable($response);
 /**
  *  your object changes...
  **/
// Getting the original object
$response  = $responseMutable->getRealInstance();