xielei/response

There is no license information available for the latest version (dev-master) of this package.

php http response encapsulation

dev-master 2019-06-19 02:25 UTC

README

php http response encapsulation

Installation

composer require xielei/response

Usage

$response = new \xielei\Response();

$response->setCode(200)->setBody('hello world!')->send();

$response->setCode(404)->setBody('Not Found!')->send();

$response->setCode(200)->setHeader('Content-Type','application/json')->setBody(json_encode(['foo'=>'bar']))->send();