2017 © Pedro PelĂĄez
 

library psr7-response-sender

Code Inc. PSR-7 response senders

image

codeinc/psr7-response-sender

Code Inc. PSR-7 response senders

  • Tuesday, June 12, 2018
  • by joanfabregat
  • Repository
  • 1 Watchers
  • 0 Stars
  • 47 Installations
  • PHP
  • 5 Dependents
  • 13 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 38 % Grown

The README.md

PSR-7 response sender

This library is a companion to the codeinc/router written in PHP 7. It provides the ResponseSender responder to stream PSR-7 responses to a web browser and the interface ResponseSenderInterface for PSR-7 reponse senders., (*1)

A response sender is capable of streaming anything implementing the PSR-7 ResponseInterface., (*2)

Usage

<?php
use CodeInc\PSR7ResponseSender\ResponseSender;
use GuzzleHttp\Psr7\Response;

// a response can be anything implementing ResponseInterface, here the Guzzle implementation
$response = new Response();

// sends the response to the web browser
$sender = new ResponseSender();
$sender->send($response);

By default ResponseSender removes all PHP native HTTP headers. You can change this behavior using the boolean constructor operator or using the methods removePhpHttpHeaders() and sendPhpHttpHeaders()., (*3)

A second class GzResponseSender is provived to send gzip compressed responses using ob_start() and ob_gzhandler(), (*4)

Installation

This library is available through Packagist and can be installed using Composer:, (*5)

composer require codeinc/psr7-response-sender

License

This library is published under the MIT license (see the LICENSE file)., (*6)

The Versions