2017 © Pedro Peláez
 

library phpresponse

Simple PHP class for handling HTTP response right way.

image

iothost/phpresponse

Simple PHP class for handling HTTP response right way.

  • Monday, March 20, 2017
  • by berkas1
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

iothost/phpresponse

Simple PHP class to handle responses correctly., (*1)

Installation

composer require iothost/phpresponse, (*2)

Example usage

$loader = require './vendor/autoload.php';
$response = new \Iothost\PhpResponse\Response();

// add header
$response->addHeader('Cache-Control: no-cache');

// set Content-Type, can be entered as a string
$response->addHeader($response::CT_TEXT);

// set HTTP status code, can be entered as a number (int)
$response->setStatus($response::STATUS_OK);

// set response body as a string
$response->setBody($string);
// OR
// set response body as JSON (from array)
$response->setBodyJson($array);


// send response
$response->send();

The Versions

20/03 2017

dev-master

9999999-dev

Simple PHP class for handling HTTP response right way.

  Sources   Download

MIT

by Avatar berkas1

20/03 2017

1.0.0

1.0.0.0

Simple PHP class for handling HTTP response right way.

  Sources   Download

MIT

by Avatar berkas1