enjoys/http

This package is abandoned and no longer maintained. The author suggests using the enjoys/server-request-wrapper package instead.

1.0.1 2020-12-13 20:12 UTC

This package is auto-updated.

Last update: 2022-03-25 15:37:58 UTC


README

Build Status Scrutinizer Code Quality Code Intelligence Status Code Coverage

Http

ServerRequest

Based on Httpsoft/Message handle for $_GET, $_POST, $_FILES

Instead of Httpsoft/Message you can use any library that implements the interface ServerRequestInterface

use

use Enjoys\Http\ServerRequest;
$request = new ServerRequest();  
// or
// $request =  new ServerRequest(\HttpSoft\ServerRequest\ServerRequestCreator::createFromGlobals())

$request->get(); //return $_GET
$request->get('key', 'default_value'); //return $_GET['key'] or mixed 'default_value' 

$request->post(); //return $_POST
$request->post('key', 'default_value'); //return $_POST['key'] or mixed 'default_value' 

$request->files(); //return array $_FILES
$request->files('key'); //return Psr\Http\Message\UploadedFileInterface $_FILES['key'] or null

$request->server(); //return $_SERVER
$request->server('key'); //return $_SERVER['key'] or null

$request->getMethod(); //return string POST, GET .... ($_SERVER['REQUEST_METHOD'])

$request->addQuery($params = []); //add to $_GET array