• PHP reference

Input

class Input

Provides static access to POST, GET, COOKIE and SESSION parameters, e.g. Input::get('foo') return bar for a URL ending in ?foo=bar.

Methods

static mixed|false post(string $key)

Get the POST request parameter with key $key.

Parameters

  • string $key

Return Value

  • mixed|false

static boolean raw(string $key)

Get raw POST request parameter value.

Parameters

  • string $key

Return Value

  • boolean

static mixed|false get(string $key)

Get the GET request query parameter with key $key.

Parameters

  • string $key

Return Value

  • mixed|false

static mixed|false session(string $key)

Get the SESSION variable with key $key.

Parameters

  • string $key

Return Value

  • mixed|false

static mixed|false cookie(string $key)

Get the COOKIE variable with key $key.

Parameters

  • string $key

Return Value

  • mixed|false

static mixed|false file(string $key)

Get the FILES variable with key $key.

Parameters

  • string $key

Return Value

  • mixed|false

static boolean validate(string $type, string $value)

Validate a string. Returns false when anything other than a string is passed as the second argument.

Valid values for $type:

  • uuid: validates a UUID v4 string
  • email: validates an email address
  • numeric: checks is a string contains only numeric characters

Parameters

  • string $type
  • string $value

Return Value

  • boolean

static string clean(string|string[] $str)

Sanitizes user input data to prevent Cross Site Scripting (XSS) hacks.

Parameters

  • string|string[] $str Input data

Return Value

  • string