PagesRequest class

Methods for identifying and loading page from current request URL.

Methods in this class should be accessed from $pages->request(), i.e.

$page = $pages->request()->getPage();

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

Show class?             Show args?        

Common

NameReturnSummary 
PagesRequest::checkScheme(Page $page)
(nothing)If the template requires a different scheme/protocol than what is here, then redirect to it. 
PagesRequest::getClosestPage()
Page NullPageGet closest matching page when getPage() returns an error/NullPage
PagesRequest::getFile()
stringGet the requested file 
PagesRequest::getLanguageName()
stringGet request language name 
PagesRequest::getLoginPageOrUrl()
string Page nullGet login Page object or URL to redirect to for login needed to access given $page
PagesRequest::getPage()
Page NullPageGet the requested page
PagesRequest::getPageForUser(Page $page, User $user)
Page NullPageUpdate/get page for given user
PagesRequest::getPageNum()
null intGet the requested pagination number 
PagesRequest::getPageNumPrefix()
null stringGet the requested pagination number prefix 
PagesRequest::getRedirectType()
intGet the redirect type (0, 301, 302, 307, 308) 
PagesRequest::getRedirectUrl()
stringGet the redirect URL 
PagesRequest::getRequestFile()
stringGet the requested file (alias of getFile method) 
PagesRequest::getRequestPage()
NullPage PageGet page that was requested 
PagesRequest::getRequestPath()
stringGet request path 
PagesRequest::getResponseCode()
intGet response http code for this request 
PagesRequest::getResponseCodeName()
stringGet response type name for this request 
PagesRequest::getResponseCodeNames()
arrayGet all possible response code names indexed by http response code 
PagesRequest::getResponseError()
stringGet message about response only if response was an error, blank otherwise 
PagesRequest::getResponseMessage()
stringGet message string about response 
PagesRequest::setPage($page)
Page NullPage nullSet current request page 
PagesRequest::setRedirectPath(string $redirectPath)
(nothing)Set the redirect path 
PagesRequest::setRedirectUrl(string $redirectUrl)
(nothing)Set the redirect URL 
PagesRequest::setRequestPath(string $requestPath)
(nothing)Set request path 
PagesRequest::setResponseMessage(string $message)
(nothing)Set response message 

Advanced

NameReturnSummary 
PagesRequest::getPageInfo()
arrayGet array of page info (as provided by PagePathFinder) 

Additional methods and properties

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

API reference based on ProcessWire core version 3.0.248

Latest news

  • ProcessWire Weekly #582
    The 582nd issue of ProcessWire Weekly brings in all the latest news from the ProcessWire community. Modules, sites, and more. Read on!
    Weekly.pw / 5 July 2025
  • New ProcessWire admin redesign
    When you upgrade to ProcessWire 3.0.248 or newer (currently the dev branch), you’ll immediately notice something new and beautiful…
    Blog / 9 May 2025
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer