Request Inputs
All inputs (form fields, query string, cookies, etc.) can be retrieved from the centro Apex\App\App object. Below
explains all functions available from the $app
object.
POST Inputs
- post (string $key, ?string $default = null, string $filters = 'escape'):?string
- hasPost (string $key):bool
- getAllPost ():array
- clearPost ():void
- replacePost (array $values):void
GET Inputs
- get (string $key, ?string $default = null, string $filters = 'escape'):?string
- hasGet (string $key):bool
- getAllGet ():array
- clearGet ():void
- replaceGet (array $values):void
REQUEST Inputs
- request (string $key, ?string $default = null, string $filters = 'escape'):?string
- hasRequest (string $key):bool
- getAllRequest ():array
- clearPostGet ():void
Cookies
- cookie (string $key, ?string $default = null, string $filters = 'escape'):?string
- setCookie (string $name, string $value, [int $expires = 0], [?array $options = null]):void
- hasCookie (string $key):bool
- getAllCookie ():array
- clearCookie ():void
- replaceCookie (array $values):void
Dynamic Path Parameters
- pathParam (string $key, ?string $default = null, string $filters = 'escape'):?string
- hasPathParam (string $key):bool
- getAllPathParams ():array
- replacePathParams (array $values):void
Uploaded Files
- file(string $key): array
- hasFile(string $key): bool
- getAllFile(): array
- clearFile(): void
- fileName(string $key): ?string
- fileTmpName(string $key): ?string
- fileType(string $key): ?string
- fileContents(string $key): ?string
- fileStream(string $key): ?stream
SERVER Variables
- server (string $key, ?string $default = null, string $filters = 'escape'):?string
- hasServer (string $key):bool
- getAllServer ():array
- replaceServer (array $values):void
Filters
Each of the methods that allow you to retrive a single variable contain a $filters
parameter, which is a string of words delimited by a period and defines the filters to apply to the variable before returning it. Below explains the available filters:
- trim - Passes the variable through the trim() function, stripping whitespace from both sides.
- escape - Applies the
filter_var()
function with optionFILTER_UNSAFE_RAW
- lower - Lowercases the value
- upper - Uppercases the value
- title - Titlecases the value
- strip_tags - Applies the
strip_tags()
function against the value - digit - Deletes all non-digit characters from the value.