class Request (View source)

Methods

mixed
capture()

Request constructor

void
setId(string|int $id)

Set the request id

string|int
getId()

Get the request ID

string|int
id()

Alias of getId

static Request
getInstance()

Singletons loader

bool
has(string $key)

Check if key is existing

array
all()

Get all input value

string
path()

Get uri send by client.

string
hostname()

Get the host name of the server.

string
url()

Get url sent by client.

string
origin()

Origin the name of the server + the scheme

string
time()

Get path sent by client.

string|null
method()

Returns the method of the request.

bool
isPost()

Check if the query is POST

bool
isGet()

Check if the query is of type GET

bool
isPut()

Check if the query is of type PUT

bool
isDelete()

Check if the query is DELETE

Collection|null
file(string $key)

Load the factory for FILES

static bool
hasFile(mixed $file)

Check if file exists

mixed
old(string $key, mixed $fullback)

Get previous request data

bool
isAjax()

Check if we are in the case of an AJAX request.

bool
is(string $match)

Check if a url matches with the pattern

bool
isReferer(string $match)

Check if a url matches with the pattern

string|null
ip()

Get client address

string|null
port()

Get client port

string
referer()

Get the source of the current request.

string|null
locale()

Get the request locale.

string|null
lang()

Get request lang.

string
protocol()

Get request protocol

bool
isProtocol(string $protocol)

Check the protocol of the request

bool
isSecure()

Check if the secure protocol

array
getHeaders()

Get Request header

string|null
getHeader(string $key)

Get Request header

bool
hasHeader(string $key)

Check if a header exists.

string|null
userAgent()

Get the client user agent

session()

Get session information

Authentication|null
user(string|null $guard = null)

Get auth user information

string|array|object|null
cookie(string $property = null)

Get cookie

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

Retrieve a value or a collection of values.

array
only(array $exceptions = [])

Retrieves the values contained in the exception table

array
ignore(array $ignores = [])

Retrieves the rest of values

validate(array $rule)

Validate incoming data

void
setBag(string $name, mixed $value)

Set the shared value in request bags

mixed
getBag(string $name)

Get the shared value in request bags

void
setBags(array $bags)

Set the shared value in request bags

array
getBags()

Get the shared value in request bags

mixed
__get($property)

__call

Details

mixed capture()

Request constructor

Return Value

mixed

Exceptions

BadRequestException

void setId(string|int $id)

Set the request id

Parameters

string|int $id

Return Value

void

string|int getId()

Get the request ID

Return Value

string|int

string|int id()

Alias of getId

Return Value

string|int

static Request getInstance()

Singletons loader

Return Value

Request

bool has(string $key)

Check if key is existing

Parameters

string $key

Return Value

bool

array all()

Get all input value

Return Value

array

string path()

Get uri send by client.

Return Value

string

string hostname()

Get the host name of the server.

Return Value

string

string url()

Get url sent by client.

Return Value

string

string origin()

Origin the name of the server + the scheme

Return Value

string

string time()

Get path sent by client.

Return Value

string

string|null method()

Returns the method of the request.

Return Value

string|null

bool isPost()

Check if the query is POST

Return Value

bool

bool isGet()

Check if the query is of type GET

Return Value

bool

bool isPut()

Check if the query is of type PUT

Return Value

bool

bool isDelete()

Check if the query is DELETE

Return Value

bool

Collection|null file(string $key)

Load the factory for FILES

Parameters

string $key

Return Value

Collection|null

static bool hasFile(mixed $file)

Check if file exists

Parameters

mixed $file

Return Value

bool

mixed old(string $key, mixed $fullback)

Get previous request data

Parameters

string $key
mixed $fullback

Return Value

mixed

bool isAjax()

Check if we are in the case of an AJAX request.

Return Value

bool

bool is(string $match)

Check if a url matches with the pattern

Parameters

string $match

Return Value

bool

bool isReferer(string $match)

Check if a url matches with the pattern

Parameters

string $match

Return Value

bool

string|null ip()

Get client address

Return Value

string|null

string|null port()

Get client port

Return Value

string|null

string referer()

Get the source of the current request.

Return Value

string

string|null locale()

Get the request locale.

The local is the original language of the client e.g fr => locale = fr_FR e.g en => locale [ en_US, en_EN]

Return Value

string|null

string|null lang()

Get request lang.

Return Value

string|null

string protocol()

Get request protocol

Return Value

string

bool isProtocol(string $protocol)

Check the protocol of the request

Parameters

string $protocol

Return Value

bool

bool isSecure()

Check if the secure protocol

Return Value

bool

array getHeaders()

Get Request header

Return Value

array

string|null getHeader(string $key)

Get Request header

Parameters

string $key

Return Value

string|null

bool hasHeader(string $key)

Check if a header exists.

Parameters

string $key

Return Value

bool

string|null userAgent()

Get the client user agent

Return Value

string|null

Session session()

Get session information

Return Value

Session

Authentication|null user(string|null $guard = null)

Get auth user information

Parameters

string|null $guard

Return Value

Authentication|null

Get cookie

Parameters

string $property

Return Value

string|array|object|null

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

Retrieve a value or a collection of values.

Parameters

string $key
mixed $default

Return Value

mixed

array only(array $exceptions = [])

Retrieves the values contained in the exception table

Parameters

array $exceptions

Return Value

array

array ignore(array $ignores = [])

Retrieves the rest of values

Parameters

array $ignores

Return Value

array

Validate validate(array $rule)

Validate incoming data

Parameters

array $rule

Return Value

Validate

void setBag(string $name, mixed $value)

Set the shared value in request bags

Parameters

string $name
mixed $value

Return Value

void

mixed getBag(string $name)

Get the shared value in request bags

Parameters

string $name

Return Value

mixed

void setBags(array $bags)

Set the shared value in request bags

Parameters

array $bags

Return Value

void

array getBags()

Get the shared value in request bags

Return Value

array

mixed __get($property)

__call

Parameters

$property

Return Value

mixed