Documentation

Request
in package

Represents an HTTP request.

The Request class provides methods for accessing information about the current HTTP request such as headers, cookies, and input data.

Table of Contents

Properties

$routeParams  : array<string|int, mixed>
Array to store route parameters.

Methods

getBody()  : array<string|int, mixed>
getMethod()  : string
Gets the HTTP method of the request.
getRouteParam()  : mixed
Get a route parameter value.
getRouteParams()  : array<string|int, mixed>
getUrl()  : string
Gets the URL of the current request.
isDelete()  : bool
Checks if the current request is a DELETE request.
isGet()  : bool
Checks if the current request is a GET request.
isHead()  : bool
Checks if the current request is a HEAD request.
isOptions()  : bool
Checks if the current request is an OPTIONS request.
isPatch()  : bool
Checks if the current request is a PATCH request.
isPost()  : bool
Checks if the current request is a POST request.
isPut()  : bool
Checks if the current request is a PUT request.
setRouteParams()  : self

Properties

$routeParams

Array to store route parameters.

private array<string|int, mixed> $routeParams = []

Methods

getBody()

public getBody() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMethod()

Gets the HTTP method of the request.

public getMethod() : string

This method returns the HTTP method used for the current request, ensuring the method is returned in lowercase format.

Return values
string

The HTTP method in lowercase

getRouteParam()

Get a route parameter value.

public getRouteParam(string $param[, mixed $default = null ]) : mixed
Parameters
$param : string
$default : mixed = null

getRouteParams()

public getRouteParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getUrl()

Gets the URL of the current request.

public getUrl() : string

This method returns the path component of the current request URI, excluding any query string parameters. It processes the REQUEST_URI server variable to remove the query string portion.

Return values
string

The URL path without query parameters

isDelete()

Checks if the current request is a DELETE request.

public isDelete() : bool

This method checks whether the HTTP method of the current request is 'delete' (case-insensitive comparison).

Return values
bool

True if the request method is 'delete', false otherwise

isGet()

Checks if the current request is a GET request.

public isGet() : bool

This method checks whether the HTTP method of the current request is 'get' (case-insensitive comparison).

Return values
bool

True if the request method is 'get', false otherwise

isHead()

Checks if the current request is a HEAD request.

public isHead() : bool

This method checks whether the HTTP method of the current request is 'head' (case-insensitive comparison).

Return values
bool

True if the request method is 'head', false otherwise

isOptions()

Checks if the current request is an OPTIONS request.

public isOptions() : bool

This method checks whether the HTTP method of the current request is 'options' (case-insensitive comparison).

Return values
bool

True if the request method is 'options', false otherwise

isPatch()

Checks if the current request is a PATCH request.

public isPatch() : bool

This method checks whether the HTTP method of the current request is 'patch' (case-insensitive comparison).

Return values
bool

True if the request method is 'patch', false otherwise

isPost()

Checks if the current request is a POST request.

public isPost() : bool

This method checks whether the HTTP method of the current request is 'post' (case-insensitive comparison).

Return values
bool

True if the request method is 'post', false otherwise

isPut()

Checks if the current request is a PUT request.

public isPut() : bool

This method checks whether the HTTP method of the current request is 'put' (case-insensitive comparison).

Return values
bool

True if the request method is 'put', false otherwise

setRouteParams()

public setRouteParams(mixed $params) : self
Parameters
$params : mixed
Return values
self
On this page

Search results