Methods |
public
|
__construct(App $config, ?URI $uri = null, string|null $body = 'php://input', ?UserAgent $userAgent = null)
Constructor
|
#
|
public
|
detectLocale(App $config)
Handles setting up the locale, perhaps auto-detecting through
content negotiation.
Handles setting up the locale, perhaps auto-detecting through
content negotiation.
|
#
|
protected
|
detectURI(string $protocol, string $baseURL)
Sets up our URI object based on the information we have. This is
either provided by the user in the baseURL Config…
Sets up our URI object based on the information we have. This is
either provided by the user in the baseURL Config setting, or
determined from the environment as needed.
Deprecated
$protocol and $baseURL are deprecated. No longer used.
|
#
|
public
|
detectPath(string $protocol = ''): string
Detects the relative path based on
the URIProtocol Config setting.
Detects the relative path based on
the URIProtocol Config setting.
|
#
|
protected
|
parseRequestURI(): string
Will parse the REQUEST_URI and automatically detect the URI from it,
fixing the query string if necessary.
Will parse the REQUEST_URI and automatically detect the URI from it,
fixing the query string if necessary.
Returns
|
#
|
protected
|
parseQueryString(): string
Parse QUERY_STRING
Parse QUERY_STRING
Will parse QUERY_STRING and automatically detect the URI from it.
|
#
|
public
|
negotiate(string $type, array $supported, bool $strictMatch = false): string
Provides a convenient way to work with the Negotiate class
for content negotiation.
Provides a convenient way to work with the Negotiate class
for content negotiation.
|
#
|
public
|
is(string|'get'|'post'|'put'|'delete'|'head'|'patch'|'options'|'json'|'ajax' $type): bool
Checks this request type.
Checks this request type.
|
#
|
public
|
isCLI(): bool
Determines if this request was made from the command line (CLI).
Determines if this request was made from the command line (CLI).
|
#
|
public
|
isAJAX(): bool
Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
|
#
|
public
|
isSecure(): bool
Attempts to detect if the current connection is secure through
a few different methods.
Attempts to detect if the current connection is secure through
a few different methods.
|
#
|
public
|
setPath(string $path, App|null $config = null): $this
Sets the relative path and updates the URI object.
Sets the relative path and updates the URI object.
Note: Since current_url() accesses the shared request
instance, this can be used to change the "current URL"
for testing.
Parameters
$path |
URI path relative to baseURL
|
$config |
Optional alternate config to use
|
|
#
|
public
|
getPath(): string
Returns the URI path relative to baseURL,
running detection as necessary.
Returns the URI path relative to baseURL,
running detection as necessary.
|
#
|
public
|
setLocale(string $locale): IncomingRequest
Sets the locale string for this request.
Sets the locale string for this request.
|
#
|
public
|
getLocale(): string
Gets the current locale, with a fallback to the default
locale if none is set.
Gets the current locale, with a fallback to the default
locale if none is set.
|
#
|
public
|
getDefaultLocale(): string
Returns the default locale as set in Config\App.php
Returns the default locale as set in Config\App.php
|
#
|
public
|
getVar(
array|string|null $index = null,
int|null $filter = null,
mixed $flags = null,
): array|bool|float|int|stdClass|string|null
Fetch an item from JSON input stream with fallback to $_REQUEST object. This is the simplest way
to grab data from the…
Fetch an item from JSON input stream with fallback to $_REQUEST object. This is the simplest way
to grab data from the request object and can be used in lieu of the
other get* methods in most cases.
Parameters
|
#
|
public
|
getJSON(bool $assoc = false, int $depth = 512, int $options = 0): array|bool|float|int|stdClass|null
A convenience method that grabs the raw input stream and decodes
the JSON into an array.
A convenience method that grabs the raw input stream and decodes
the JSON into an array.
If $assoc == true, then all objects in the response will be converted
to associative arrays.
Parameters
$assoc |
Whether to return objects as associative arrays
|
$depth |
How many levels deep to decode
|
$options |
Bitmask of options
|
|
#
|
public
|
getJsonVar(
array|string|null $index = null,
bool $assoc = false,
int|null $filter = null,
array|int|null $flags = null,
): array|bool|float|int|stdClass|string|null
Get a specific variable from a JSON input stream
Get a specific variable from a JSON input stream
Parameters
$index |
The variable that you want which can use dot syntax for getting specific values.
|
$assoc |
If true, return the result as an associative array.
|
$filter |
Filter Constant
|
$flags |
Option
|
|
#
|
public
|
getRawInput(): array
A convenience method that grabs the raw input stream(send method in PUT, PATCH, DELETE) and decodes
the String into an…
A convenience method that grabs the raw input stream(send method in PUT, PATCH, DELETE) and decodes
the String into an array.
|
#
|
public
|
getRawInputVar(array|string|null $index = null, int|null $filter = null, array|int|null $flags = null): mixed
Gets a specific variable from raw input stream (send method in PUT, PATCH, DELETE).
Gets a specific variable from raw input stream (send method in PUT, PATCH, DELETE).
Parameters
$index |
The variable that you want which can use dot syntax for getting specific values.
|
$filter |
Filter Constant
|
$flags |
Option
|
|
#
|
public
|
getGet(array|string|null $index = null, int|null $filter = null, mixed|null $flags = null): mixed
Fetch an item from GET data.
Fetch an item from GET data.
Parameters
$index |
Index for item to fetch from $_GET.
|
$filter |
A filter name to apply.
|
|
#
|
public
|
getPost(array|string|null $index = null, int|null $filter = null, mixed $flags = null): mixed
Fetch an item from POST.
Parameters
$index |
Index for item to fetch from $_POST.
|
$filter |
A filter name to apply
|
|
#
|
public
|
getPostGet(array|string|null $index = null, int|null $filter = null, mixed $flags = null): mixed
Fetch an item from POST data with fallback to GET.
Fetch an item from POST data with fallback to GET.
Parameters
$index |
Index for item to fetch from $_POST or $_GET
|
$filter |
A filter name to apply
|
|
#
|
public
|
getGetPost(array|string|null $index = null, int|null $filter = null, mixed $flags = null): mixed
Fetch an item from GET data with fallback to POST.
Fetch an item from GET data with fallback to POST.
Parameters
$index |
Index for item to be fetched from $_GET or $_POST
|
$filter |
A filter name to apply
|
|
#
|
public
|
getCookie(array|string|null $index = null, int|null $filter = null, mixed $flags = null): mixed
Fetch an item from the COOKIE array.
Fetch an item from the COOKIE array.
Parameters
$index |
Index for item to be fetched from $_COOKIE
|
$filter |
A filter name to be applied
|
|
#
|
public
|
getUserAgent(): UserAgent
Fetch the user agent string
Fetch the user agent string
|
#
|
public
|
getOldInput(string $key): array|string|null
Attempts to get old Input data that has been flashed to the session
with redirect_with_input(). It first checks for the…
Attempts to get old Input data that has been flashed to the session
with redirect_with_input(). It first checks for the data in the old
POST data, then the old GET data and finally check for dot arrays
|
#
|
public
|
getFiles(): array
Returns an array of all files that have been uploaded with this
request. Each file is represented by an UploadedFile…
Returns an array of all files that have been uploaded with this
request. Each file is represented by an UploadedFile instance.
|
#
|
public
|
getFileMultiple(string $fileID): array|null
Verify if a file exist, by the name of the input field used to upload it, in the collection
of uploaded files and if is…
Verify if a file exist, by the name of the input field used to upload it, in the collection
of uploaded files and if is have been uploaded with multiple option.
|
#
|
public
|
getFile(string $fileID): UploadedFile|null
Retrieves a single file by the name of the input field used
to upload it.
Retrieves a single file by the name of the input field used
to upload it.
|
#
|
protected
|
removeRelativeDirectory(string $uri): string
Remove relative directory (../) and multi slashes (///)
Remove relative directory (../) and multi slashes (///)
Do some final cleaning of the URI and return it, currently only used in static::_parse_request_uri()
Deprecated
Use URI::removeDotSegments() directly
|
#
|