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
Requires
- php: ^7.4|^8.0
- httpsoft/http-server-request: ^1.0.0
Requires (Dev)
- phpunit/phpunit: ^9.4
- squizlabs/php_codesniffer: ^3.0
README
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