cjrasmussen/request

Helper class for working with information about web requests

2.1.5 2024-07-08 19:04 UTC

This package is auto-updated.

Last update: 2024-11-08 19:40:30 UTC


README

Helper class for working with information about web requests. Useful for accessing request data in an object-oriented fashion.

Usage

use cjrasmussen\Request\RequestData;

$requestData = new RequestData($_GET, $_POST, $_COOKIES, $_FILES, $_SERVER, $_ENV);

$isWebRequest = $requestData->isWebRequest();

if ($isWebRequest) {
    $url = $requestData->getRequestedUrl();
}

// access $_GET['id']
$requestData->query->get('id');

Installation

Simply add a dependency on cjrasmussen/request to your composer.json file if you use Composer to manage the dependencies of your project:

composer require cjrasmussen/request

Although it's recommended to use Composer, you can actually include the file(s) any way you want.

License

Request is MIT licensed.