$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 
callUnknown(string $method, array $arguments)
mixed nullCall unknown method
cookie()
null mixed WireInputDataRetrieve a named COOKIE variable value or all COOKIE variables
Can also be used as property: cookie
 
get()
null mixed WireInputDataRetrieve a named GET variable value, or all GET variables (from URL query string)
Can also be used as property: get
 
is(string $method)
boolIs the current request of the specified type? 
post()
null mixed WireInputDataRetrieve a named POST variable value, or all POST variables
Can also be used as property: post
 
requestMethod()
string boolReturn the current request method (i.e. GET, POST, etc.) or blank if not known 
whitelist()
null mixed WireInputDataGet or set a whitelist variable
Can also be used as property: whitelist
 

URL segments

NameReturnSummary 
pageNum()
intReturn the current pagination/page number (starting from 1)
Can also be used as property: pageNum
 
pageNumStr()
stringReturn the string that represents the page number URL segment 
setPageNum(int $num)
NoneSet the current page number. 
setUrlSegment(int $num, $value)
NoneSet a URL segment value 
urlSegment()
string intRetrieve matching URL segment number or pattern 
urlSegment1()
string int boolSame as urlSegment() method but apply only to 1st URL segment. 3.0.155
Can also be used as property: urlSegment1
urlSegment2()
string int boolSame as urlSegment() method but apply only to 2nd URL segment. 3.0.155
Can also be used as property: urlSegment2
urlSegment3()
string int boolSame as urlSegment() method but apply only to 3rd URL segment. 3.0.155
Can also be used as property: urlSegment3
urlSegmentFirst()
string int boolSame as urlSegment() method but apply only to first URL segment. 3.0.155
Can also be used as property: urlSegmentFirst
urlSegmentLast()
string int boolSame as urlSegment() method but apply only to last URL segment. 3.0.155
Can also be used as property: urlSegmentLast
urlSegmentStr()
stringGet the string of URL segments separated by slashes
Can also be used as property: urlSegmentStr
 
urlSegments()
arrayRetrieve array of all URL segments
Can also be used as property: urlSegments
 

URLs

NameReturnSummary 
canonicalUrl()
stringGenerate canonical URL for current page and request 
httpHostUrl()
stringGet current scheme and URL for hostname without any path or query string 
httpUrl()
stringGet the http URL that initiated the current request, including scheme, URL segments and page numbers
Can also be used as property: httpUrl
 
httpsUrl()
stringSame as httpUrl() method but always uses https scheme, rather than current request scheme 
queryString()
stringReturn the unsanitized query string that was part of this request, or blank if none
Can also be used as property: queryString
 
queryStringClean()
stringReturn a cleaned query string that was part of this request, or blank if none 
scheme()
stringReturn the current access scheme/protocol
Can also be used as property: scheme
 
url()
stringGet the URL that initiated the current request, including URL segments and page numbers
Can also be used as property: 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.251