class ServerRequest extends ServerRequest

Properties

static ServerRequest|null $instance

Methods

static ServerRequest
get()

Get the singleton instance of the ServerRequest.

array
all()

Retrieve all query and body parameters.

mixed
input(string $key, mixed $default = null)

Retrieve a specific input value.

bool
filled(string $key)

Check if a specific key is filled.

addGet(string $name, mixed $value)

Add a parameter to the query string.

addToBody(string $name, mixed $value)

Add a parameter to the request body.

add(string $name, mixed $value)

Add a parameter to the request, either to the query string or body based on the HTTP method.

addFile(string $path, string $name, string $mime_type)

Add a file to the uploaded files.

bool
isAjax()

Check if the current request is an AJAX request.

Details

at line 16
static ServerRequest get()

Get the singleton instance of the ServerRequest.

Return Value

ServerRequest

at line 28
array all()

Retrieve all query and body parameters.

Return Value

array

Merged array of query and body parameters.

at line 39
mixed input(string $key, mixed $default = null)

Retrieve a specific input value.

Parameters

string $key

The key to retrieve.

mixed $default

The default value if the key does not exist.

Return Value

mixed

The value of the key or the default value.

at line 49
bool filled(string $key)

Check if a specific key is filled.

Parameters

string $key

The key to check.

Return Value

bool

True if the key exists, false otherwise.

at line 60
ServerRequest addGet(string $name, mixed $value)

Add a parameter to the query string.

Parameters

string $name

The name of the parameter.

mixed $value

The value of the parameter.

Return Value

ServerRequest

The updated request instance.

at line 76
ServerRequest addToBody(string $name, mixed $value)

Add a parameter to the request body.

Parameters

string $name

The name of the parameter.

mixed $value

The value of the parameter.

Return Value

ServerRequest

The updated request instance.

at line 92
ServerRequest add(string $name, mixed $value)

Add a parameter to the request, either to the query string or body based on the HTTP method.

Parameters

string $name

The name of the parameter.

mixed $value

The value of the parameter.

Return Value

ServerRequest

The updated request instance.

at line 107
ServerRequest addFile(string $path, string $name, string $mime_type)

Add a file to the uploaded files.

Parameters

string $path

The file path.

string $name

The file name.

string $mime_type

The MIME type of the file.

Return Value

ServerRequest

The updated request instance.

at line 127
bool isAjax()

Check if the current request is an AJAX request.

Return Value

bool

True if the request is an AJAX request, false otherwise.