Skip to content

rogerthomas84/ohhttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OhHttp

OhHttp is a HTTP Request and Response library for PHP

Latest Stable Version Total Downloads Latest Unstable Version License Build Status

Using Composer

To use OhHttp with Composer, add the dependency (and version constraint) to your require block inside your composer.json file.

{
    "require": {
        "rogerthomas84/ohhttp": "1.0.*"
    }
}

Quick Start

You can use the \OhHttp\Request and \OhHttp\Response to provide a simplified HTTP Request and Response, but moving towards a more OO approach.

Request

$request = new \OhHttp\Request();
if ($request->isGet()) {
    $userId = $request->getParam('id', null);
    // do something
} elseif ($request->isPost()) {
    $userId = $request->getParam('id', null);
    // do something
}

Response

$response = new \OhHttp\Response();
$response->setHeader('Content-Type', 'application/json');
$response->setBody('{"foo":"bar"}');
$response->send();

About

OhHttp is a HTTP Request and Response library for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages