symbiotic/http-response-mutable

可变响应,装饰器设计用于通过Psr容器与响应对象一起工作

1.4.0 2022-09-11 02:31 UTC

This package is auto-updated.

Last update: 2024-09-11 06:59:29 UTC


README

警告

不建议广泛使用此装饰器!我们使用它通过DI容器将其传递到控制器中。

特点

  • 兼容PSR-7(Http Message)
  • 简单的类
  • php 7.2+

安装

composer require symbiotic/http-response-mutable 

使用

可变响应,装饰器设计用于通过Psr容器与响应对象一起工作。

/**
 * @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();