$input

Provides a means to get user input from URLs, GET, POST, and COOKIE variables and more.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the WireInput class also inherits all the methods and properties of: Wire.

Show $var?     Show args?       Only hookable?    

Common

NameReturnSummary 
$input->cookie()
null mixed WireInputData

Retrieve a named COOKIE variable value or all COOKIE variables


Can also be used as property: $input->cookie
 
$input->get()
null mixed WireInputData

Retrieve a named GET variable value, or all GET variables (from URL query string)


Can also be used as property: $input->get
 
$input->is(string $method)
bool

Is the current request of the specified type?

 
$input->post()
null mixed WireInputData

Retrieve a named POST variable value, or all POST variables


Can also be used as property: $input->post
 
$input->requestMethod()
string bool

Return the current request method (i.e. GET, POST, etc.) or blank if not known

 
$input->whitelist()
null mixed WireInputData

Get or set a whitelist variable


Can also be used as property: $input->whitelist
 

URL segments

NameReturnSummary 
$input->pageNum()
int

Return the current pagination/page number (starting from 1)


Can also be used as property: $input->pageNum
 
$input->pageNumStr()
string

Return the string that represents the page number URL segment

 
$input->setPageNum(int $num)
None

Set the current page number.

 
$input->setUrlSegment(int $num, $value)
None

Set a URL segment value

 
$input->urlSegment()
string int

Retrieve matching URL segment number or pattern

 
$input->urlSegment1()
string int boolSame as urlSegment() method but apply only to 1st URL segment. 3.0.155
Can also be used as property: $input->urlSegment1
$input->urlSegment2()
string int boolSame as urlSegment() method but apply only to 2nd URL segment. 3.0.155
Can also be used as property: $input->urlSegment2
$input->urlSegment3()
string int boolSame as urlSegment() method but apply only to 3rd URL segment. 3.0.155
Can also be used as property: $input->urlSegment3
$input->urlSegmentFirst()
string int boolSame as urlSegment() method but apply only to first URL segment. 3.0.155
Can also be used as property: $input->urlSegmentFirst
$input->urlSegmentLast()
string int boolSame as urlSegment() method but apply only to last URL segment. 3.0.155
Can also be used as property: $input->urlSegmentLast
$input->urlSegmentStr()
string

Get the string of URL segments separated by slashes


Can also be used as property: $input->urlSegmentStr
 
$input->urlSegments()
array

Retrieve array of all URL segments


Can also be used as property: $input->urlSegments
 

URLs

NameReturnSummary 
$input->canonicalUrl()
string

Generate canonical URL for current page and request

 
$input->httpHostUrl()
string

Get current scheme and URL for hostname without any path or query string

 
$input->httpUrl()
string

Get the http URL that initiated the current request, including scheme, URL segments and page numbers


Can also be used as property: $input->httpUrl
 
$input->httpsUrl()
string

Same as httpUrl() method but always uses https scheme, rather than current request scheme

 
$input->queryString()
string

Return the unsanitized query string that was part of this request, or blank if none


Can also be used as property: $input->queryString
 
$input->queryStringClean()
string

Return a cleaned query string that was part of this request, or blank if none

 
$input->scheme()
string

Return the current access scheme/protocol


Can also be used as property: $input->scheme
 
$input->url()
string

Get the URL that initiated the current request, including URL segments and page numbers


Can also be used as property: $input->url
 

Additional methods and properties

In addition to the methods and properties above, WireInput also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.252