Request
extends AbstractRequest
in package
implements
ServerRequestInterface
HTTP server request class
Tags
Table of Contents
Interfaces
- ServerRequestInterface
Properties
- $attributes : array<string|int, mixed>
- Request attributes, per PSR-7 (middleware-style per-request key-value bag)
- $auth : Auth|null
- HTTP auth object
- $body : Body|null
- Body
- $cookie : array<string|int, mixed>
- COOKIE array
- $cookieParamsOverride : array<string|int, mixed>|null
- Cookie params override, per PSR-7 withCookieParams() (null = derive from $this->cookie)
- $data : Data|null
- Server request data object
- $env : array<string|int, mixed>
- ENV array
- $headerIndex : array<string|int, mixed>
- Case-folded header name index (lowercase name => actual stored key), kept in sync by addHeader()/removeHeader()/setHeaders()/removeHeaders() so resolveHeaderName() - used by every PSR-7 case-insensitive lookup (getHeader()/withHeader()/withAddedHeader()/ withoutHeader()) - is an O(1) lookup instead of a linear strcasecmp() scan of every header.
- $headers : array<string|int, mixed>
- Headers
- $methodOverride : string|null
- Method override (from withMethod)
- $parsedBodyOverridden : bool
- Whether withParsedBody() has been called (distinguishes "not set" from "set to null")
- $parsedBodyOverride : mixed
- Parsed body override, per PSR-7 withParsedBody()
- $protocolVersion : string
- HTTP protocol version, per PSR-7
- $queryParamsOverride : array<string|int, mixed>|null
- Query params override, per PSR-7 withQueryParams() (null = derive from $this->data)
- $requestTargetOverride : string|null
- Explicit request-target override, per PSR-7 (null = derive from the URI)
- $server : array<string|int, mixed>
- SERVER array
- $uploadedFilesOverride : array<string|int, mixed>|null
- Uploaded files override, per PSR-7 withUploadedFiles() (null = derive from $this->data)
- $uri : Uri|null
- Request URI object
Methods
- __clone() : void
- Deep-clone the URI so a with*() clone never shares a mutable Uri instance with the instance it was cloned from
- __construct() : mixed
- Constructor
- __get() : mixed
- Magic method to get a value from one of the server/environment variables
- accepts() : bool
- Whether the request's Accept header accepts the given media type(s)
- acceptsHtml() : bool
- Whether the request accepts an HTML response
- acceptsJson() : bool
- Whether the request accepts a JSON response
- acceptsXml() : bool
- Whether the request accepts an XML response (either canonical XML media type)
- addHeader() : AbstractRequestResponse
- Add a header
- addHeaders() : AbstractRequestResponse
- Add all headers
- clearUri() : AbstractRequest
- Clear URI
- create() : Request
- Factory to create a new request object
- createWithBasePath() : Request
- Factory to create a new request object with a base path reference for the request URI
- decodeBodyContent() : Body
- Decode the body
- getAccept() : AcceptHeader
- Get the parsed Accept header
- getAttribute() : mixed
- Get a request attribute, per PSR-7
- getAttributes() : array<string|int, mixed>
- Get all request attributes, per PSR-7
- getAuth() : Auth
- Get the auth object
- getBasePath() : string
- Get the base path
- getBody() : Body
- Get the body, per PSR-7 (a transient, never-stored empty Body when none is set, so hasBody() remains unaffected by calling this)
- getBodyContent() : mixed
- Get body content
- getBodyContentLength() : int
- Get body content length
- getCookie() : string|array<string|int, mixed>|null
- Get a value from $_COOKIE, or the whole array
- getCookieParams() : array<string|int, mixed>
- Get the cookie params, per PSR-7
- getData() : Data
- Get data
- getDelete() : string|array<string|int, mixed>|null
- Get a value from DELETE query data, or the whole array
- getDocumentRoot() : string|null
- Get the document root
- getEnv() : string|array<string|int, mixed>|null
- Get a value from $_ENV, or the whole array
- getFiles() : string|array<string|int, mixed>|null
- Get a value from $_FILES, or the whole array
- getFullHost() : string
- Get host with port
- getFullUriString() : string
- Get the full request URI, including base path
- getHeader() : array<string|int, mixed>
- Get all string values for a header, per PSR-7 (empty array if absent, case-insensitive)
- getHeaderAsString() : mixed
- Get a header
- getHeaderLine() : string
- Get a header's values comma-joined into one string, per PSR-7
- getHeaderObject() : mixed
- Get a header
- getHeaderObjects() : array<string|int, mixed>
- Get all headers
- getHeaders() : array<string|int, mixed>
- Get all headers, per PSR-7 (each header's values array-wrapped)
- getHeadersAsArray() : array<string|int, mixed>
- Get all header values as associative array
- getHeadersAsString() : string
- Get all header values formatted string
- getHeaderValue() : mixed
- Get header value
- getHeaderValueAsString() : string|null
- Get header value as string
- getHost() : string
- Get host (without port)
- getIp() : string
- Get client's IP
- getMethod() : string
- Get the method
- getParsedBody() : array<string|int, mixed>|object|null
- Get the parsed body, per PSR-7
- getParsedData() : string|array<string|int, mixed>|null
- Get a value from parsed data, or the whole array
- getPatch() : string|array<string|int, mixed>|null
- Get a value from PATCH query data, or the whole array
- getPort() : string|null
- Get the server port
- getPost() : string|array<string|int, mixed>|null
- Get a value from $_POST, or the whole array
- getPreferredType() : string|null
- Given the media types this server can respond with, return the client's best match (or null if none of them are acceptable)
- getProtocolVersion() : string
- Get the HTTP protocol version, per PSR-7
- getPut() : string|array<string|int, mixed>|null
- Get a value from PUT query data, or the whole array
- getQuery() : string|array<string|int, mixed>|null
- Get a value from $_GET, or the whole array
- getQueryData() : string|array<string|int, mixed>|null
- Get a value from query data, or the whole array
- getQueryParams() : array<string|int, mixed>
- Get the query params, per PSR-7
- getRawData() : string|null
- Get the raw data
- getRequestTarget() : string
- Get the request target, per PSR-7 (path + query, or '/' with no URI, unless overridden)
- getScheme() : string
- Get scheme
- getSegment() : string|null
- Get a path segment, divided by the forward slash, where $i refers to the array key index, i.e., 0 1 2 /hello/world/page
- getSegments() : array<string|int, mixed>
- Get all path segments
- getServer() : string|array<string|int, mixed>|null
- Get a value from $_SERVER, or the whole array
- getServerParams() : array<string|int, mixed>
- Get the server params, per PSR-7 (alias of getServer())
- getUploadedFiles() : array<string|int, mixed>
- Get the uploaded files, per PSR-7 - an array of UploadedFileInterface instances built from the native $_FILES-shaped data, unless overridden
- getUri() : Uri
- Get URI, per PSR-7 (a transient, never-stored empty Uri when none is set, so hasUri() remains unaffected by calling this)
- getUriAsString() : string
- Get URI as string
- getUriString() : string
- Get the request URI
- hasAuth() : bool
- Has auth object
- hasBody() : bool
- Has a body
- hasBodyContent() : bool
- Has body content
- hasData() : bool
- Has data
- hasFiles() : bool
- Return whether or not the request has FILES
- hasHeader() : bool
- Has a header
- hasHeaders() : bool
- Determine if there are headers
- hasParsedData() : bool
- Has parsed data
- hasQueryData() : bool
- Has query data
- hasRawData() : bool
- Has raw data
- hasUri() : bool
- Has URI
- isConnect() : bool
- Return whether or not the method is CONNECT
- isDelete() : bool
- Return whether or not the method is DELETE
- isGet() : bool
- Return whether or not the method is GET
- isHead() : bool
- Return whether or not the method is HEAD
- isOptions() : bool
- Return whether or not the method is OPTIONS
- isPatch() : bool
- Return whether or not the method is PATCH
- isPost() : bool
- Return whether or not the method is POST
- isPut() : bool
- Return whether or not the method is PUT
- isSecure() : bool
- Return whether or not the request is secure
- isTrace() : bool
- Return whether or not the method is TRACE
- removeBody() : AbstractRequestResponse
- Remove the body
- removeHeader() : AbstractRequestResponse
- Remove a header
- removeHeaders() : AbstractRequestResponse
- Remove all headers
- setAuth() : Request
- Set the auth object
- setBasePath() : Request
- Set the base path
- setBody() : AbstractRequestResponse
- Set the body
- setHeaders() : AbstractRequestResponse
- Set all headers (clear out any existing headers)
- setUri() : AbstractRequest
- Set URI
- withAddedHeader() : static
- Return an instance with the specified header value(s) appended, per PSR-7
- withAttribute() : static
- Return an instance with the specified attribute set, per PSR-7
- withBody() : static
- Return an instance with the specified body, per PSR-7
- withCookieParams() : static
- Return an instance with the specified cookie params, per PSR-7
- withHeader() : static
- Return an instance with the specified header, replacing any existing values, per PSR-7
- withMethod() : static
- Return a new request with the specified request method
- withoutAttribute() : static
- Return an instance without the specified attribute, per PSR-7
- withoutHeader() : static
- Return an instance without the specified header, per PSR-7
- withParsedBody() : static
- Return an instance with the specified parsed body, per PSR-7
- withProtocolVersion() : static
- Return an instance with the specified HTTP protocol version, per PSR-7
- withQueryParams() : static
- Return an instance with the specified query params, per PSR-7
- withRequestTarget() : static
- Return an instance with the specified request target, per PSR-7
- withUploadedFiles() : static
- Return an instance with the specified uploaded files, per PSR-7
- withUri() : static
- Return an instance with the specified URI, per PSR-7
Properties
$attributes
Request attributes, per PSR-7 (middleware-style per-request key-value bag)
protected
array<string|int, mixed>
$attributes
= []
$auth
HTTP auth object
protected
Auth|null
$auth
= null
$body
Body
protected
Body|null
$body
= null
$cookie
COOKIE array
protected
array<string|int, mixed>
$cookie
= []
$cookieParamsOverride
Cookie params override, per PSR-7 withCookieParams() (null = derive from $this->cookie)
protected
array<string|int, mixed>|null
$cookieParamsOverride
= null
$data
Server request data object
protected
Data|null
$data
= null
$env
ENV array
protected
array<string|int, mixed>
$env
= []
$headerIndex
Case-folded header name index (lowercase name => actual stored key), kept in sync by addHeader()/removeHeader()/setHeaders()/removeHeaders() so resolveHeaderName() - used by every PSR-7 case-insensitive lookup (getHeader()/withHeader()/withAddedHeader()/ withoutHeader()) - is an O(1) lookup instead of a linear strcasecmp() scan of every header.
protected
array<string|int, mixed>
$headerIndex
= []
$headers
Headers
protected
array<string|int, mixed>
$headers
= []
$methodOverride
Method override (from withMethod)
protected
string|null
$methodOverride
= null
$parsedBodyOverridden
Whether withParsedBody() has been called (distinguishes "not set" from "set to null")
protected
bool
$parsedBodyOverridden
= false
$parsedBodyOverride
Parsed body override, per PSR-7 withParsedBody()
protected
mixed
$parsedBodyOverride
= null
$protocolVersion
HTTP protocol version, per PSR-7
protected
string
$protocolVersion
= '1.1'
$queryParamsOverride
Query params override, per PSR-7 withQueryParams() (null = derive from $this->data)
protected
array<string|int, mixed>|null
$queryParamsOverride
= null
$requestTargetOverride
Explicit request-target override, per PSR-7 (null = derive from the URI)
protected
string|null
$requestTargetOverride
= null
$server
SERVER array
protected
array<string|int, mixed>
$server
= []
$uploadedFilesOverride
Uploaded files override, per PSR-7 withUploadedFiles() (null = derive from $this->data)
protected
array<string|int, mixed>|null
$uploadedFilesOverride
= null
$uri
Request URI object
protected
Uri|null
$uri
= null
Methods
__clone()
Deep-clone the URI so a with*() clone never shares a mutable Uri instance with the instance it was cloned from
public
__clone() : void
__construct()
Constructor
public
__construct([Uri|string|null $uri = null ][, mixed $filters = null ][, mixed $streamToFile = null ][, bool $populateFromGlobals = true ][, array<string|int, mixed> $serverParams = [] ]) : mixed
Instantiate the request object
Parameters
- $uri : Uri|string|null = null
- $filters : mixed = null
- $streamToFile : mixed = null
- $populateFromGlobals : bool = true
- $serverParams : array<string|int, mixed> = []
Tags
__get()
Magic method to get a value from one of the server/environment variables
public
__get(string $name) : mixed
Parameters
- $name : string
accepts()
Whether the request's Accept header accepts the given media type(s)
public
accepts(string|array<string|int, mixed> $types[, AcceptSpecificity $specificity = AcceptSpecificity::Any ]) : bool
Parameters
- $types : string|array<string|int, mixed>
- $specificity : AcceptSpecificity = AcceptSpecificity::Any
Return values
boolacceptsHtml()
Whether the request accepts an HTML response
public
acceptsHtml([AcceptSpecificity $specificity = AcceptSpecificity::Loose ]) : bool
Defaults to AcceptSpecificity::Loose - a bare '/' (no Accept header, or a generic client default like curl's) is not treated as a real preference for HTML.
Parameters
- $specificity : AcceptSpecificity = AcceptSpecificity::Loose
Return values
boolacceptsJson()
Whether the request accepts a JSON response
public
acceptsJson([AcceptSpecificity $specificity = AcceptSpecificity::Loose ]) : bool
Defaults to AcceptSpecificity::Loose - a bare '/' (no Accept header, or a generic client default like curl's) is not treated as a real preference for JSON.
Parameters
- $specificity : AcceptSpecificity = AcceptSpecificity::Loose
Return values
boolacceptsXml()
Whether the request accepts an XML response (either canonical XML media type)
public
acceptsXml([AcceptSpecificity $specificity = AcceptSpecificity::Loose ]) : bool
Defaults to AcceptSpecificity::Loose - a bare '/' (no Accept header, or a generic client default like curl's) is not treated as a real preference for XML.
Parameters
- $specificity : AcceptSpecificity = AcceptSpecificity::Loose
Return values
booladdHeader()
Add a header
public
addHeader(Header|string|int $header[, string|null $value = null ]) : AbstractRequestResponse
Parameters
- $header : Header|string|int
- $value : string|null = null
Return values
AbstractRequestResponseaddHeaders()
Add all headers
public
addHeaders(array<string|int, mixed> $headers) : AbstractRequestResponse
Parameters
- $headers : array<string|int, mixed>
Return values
AbstractRequestResponseclearUri()
Clear URI
public
clearUri() : AbstractRequest
Return values
AbstractRequestcreate()
Factory to create a new request object
public
static create([Uri|null $uri = null ][, mixed $filters = null ][, mixed $streamToFile = null ]) : Request
Parameters
- $uri : Uri|null = null
- $filters : mixed = null
- $streamToFile : mixed = null
Tags
Return values
RequestcreateWithBasePath()
Factory to create a new request object with a base path reference for the request URI
public
static createWithBasePath(string $basePath[, mixed $filters = null ][, mixed $streamToFile = null ]) : Request
Parameters
- $basePath : string
- $filters : mixed = null
- $streamToFile : mixed = null
Return values
RequestdecodeBodyContent()
Decode the body
public
decodeBodyContent([string|null $body = null ]) : Body
Parameters
- $body : string|null = null
Return values
BodygetAccept()
Get the parsed Accept header
public
getAccept() : AcceptHeader
Return values
AcceptHeadergetAttribute()
Get a request attribute, per PSR-7
public
getAttribute(string $name[, mixed $default = null ]) : mixed
Parameters
- $name : string
- $default : mixed = null
getAttributes()
Get all request attributes, per PSR-7
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getAuth()
Get the auth object
public
getAuth() : Auth
Return values
AuthgetBasePath()
Get the base path
public
getBasePath() : string
Return values
stringgetBody()
Get the body, per PSR-7 (a transient, never-stored empty Body when none is set, so hasBody() remains unaffected by calling this)
public
getBody() : Body
Return values
BodygetBodyContent()
Get body content
public
getBodyContent() : mixed
getBodyContentLength()
Get body content length
public
getBodyContentLength([bool $mb = false ]) : int
Parameters
- $mb : bool = false
Return values
intgetCookie()
Get a value from $_COOKIE, or the whole array
public
getCookie([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetCookieParams()
Get the cookie params, per PSR-7
public
getCookieParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getData()
Get data
public
getData() : Data
Return values
DatagetDelete()
Get a value from DELETE query data, or the whole array
public
getDelete([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetDocumentRoot()
Get the document root
public
getDocumentRoot() : string|null
Return values
string|nullgetEnv()
Get a value from $_ENV, or the whole array
public
getEnv([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetFiles()
Get a value from $_FILES, or the whole array
public
getFiles([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetFullHost()
Get host with port
public
getFullHost() : string
Return values
stringgetFullUriString()
Get the full request URI, including base path
public
getFullUriString() : string
Return values
stringgetHeader()
Get all string values for a header, per PSR-7 (empty array if absent, case-insensitive)
public
getHeader(string $name) : array<string|int, mixed>
Parameters
- $name : string
Return values
array<string|int, mixed>getHeaderAsString()
Get a header
public
getHeaderAsString(string $name) : mixed
Parameters
- $name : string
getHeaderLine()
Get a header's values comma-joined into one string, per PSR-7
public
getHeaderLine(string $name) : string
Parameters
- $name : string
Return values
stringgetHeaderObject()
Get a header
public
getHeaderObject(string $name) : mixed
Parameters
- $name : string
getHeaderObjects()
Get all headers
public
getHeaderObjects() : array<string|int, mixed>
Return values
array<string|int, mixed>getHeaders()
Get all headers, per PSR-7 (each header's values array-wrapped)
public
getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>getHeadersAsArray()
Get all header values as associative array
public
getHeadersAsArray([bool $asStrings = true ]) : array<string|int, mixed>
Parameters
- $asStrings : bool = true
Return values
array<string|int, mixed>getHeadersAsString()
Get all header values formatted string
public
getHeadersAsString([mixed $status = null ][, string $eol = "
" ]) : string
Parameters
- $status : mixed = null
- $eol : string = " "
Return values
stringgetHeaderValue()
Get header value
public
getHeaderValue(string $name[, int $i = 0 ]) : mixed
Parameters
- $name : string
- $i : int = 0
getHeaderValueAsString()
Get header value as string
public
getHeaderValueAsString(string $name[, int $i = 0 ]) : string|null
Parameters
- $name : string
- $i : int = 0
Return values
string|nullgetHost()
Get host (without port)
public
getHost() : string
Return values
stringgetIp()
Get client's IP
public
getIp([bool $proxy = true ]) : string
Parameters
- $proxy : bool = true
Return values
stringgetMethod()
Get the method
public
getMethod() : string
Return values
stringgetParsedBody()
Get the parsed body, per PSR-7
public
getParsedBody() : array<string|int, mixed>|object|null
Return values
array<string|int, mixed>|object|nullgetParsedData()
Get a value from parsed data, or the whole array
public
getParsedData([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetPatch()
Get a value from PATCH query data, or the whole array
public
getPatch([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetPort()
Get the server port
public
getPort() : string|null
Return values
string|nullgetPost()
Get a value from $_POST, or the whole array
public
getPost([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetPreferredType()
Given the media types this server can respond with, return the client's best match (or null if none of them are acceptable)
public
getPreferredType(array<string|int, mixed> $available[, AcceptSpecificity $specificity = AcceptSpecificity::Any ]) : string|null
Parameters
- $available : array<string|int, mixed>
- $specificity : AcceptSpecificity = AcceptSpecificity::Any
Return values
string|nullgetProtocolVersion()
Get the HTTP protocol version, per PSR-7
public
getProtocolVersion() : string
Return values
stringgetPut()
Get a value from PUT query data, or the whole array
public
getPut([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetQuery()
Get a value from $_GET, or the whole array
public
getQuery([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetQueryData()
Get a value from query data, or the whole array
public
getQueryData([string|null $key = null ]) : string|array<string|int, mixed>|null
This always returns null now: the QUERY_STRING re-parse that used to populate $queryData was removed. Use getQuery() instead, which reads directly from PHP's native $_GET.
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetQueryParams()
Get the query params, per PSR-7
public
getQueryParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getRawData()
Get the raw data
public
getRawData() : string|null
Return values
string|nullgetRequestTarget()
Get the request target, per PSR-7 (path + query, or '/' with no URI, unless overridden)
public
getRequestTarget() : string
Return values
stringgetScheme()
Get scheme
public
getScheme() : string
Return values
stringgetSegment()
Get a path segment, divided by the forward slash, where $i refers to the array key index, i.e., 0 1 2 /hello/world/page
public
getSegment(int $i) : string|null
Parameters
- $i : int
Return values
string|nullgetSegments()
Get all path segments
public
getSegments() : array<string|int, mixed>
Return values
array<string|int, mixed>getServer()
Get a value from $_SERVER, or the whole array
public
getServer([string|null $key = null ]) : string|array<string|int, mixed>|null
Parameters
- $key : string|null = null
Return values
string|array<string|int, mixed>|nullgetServerParams()
Get the server params, per PSR-7 (alias of getServer())
public
getServerParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getUploadedFiles()
Get the uploaded files, per PSR-7 - an array of UploadedFileInterface instances built from the native $_FILES-shaped data, unless overridden
public
getUploadedFiles() : array<string|int, mixed>
Return values
array<string|int, mixed>getUri()
Get URI, per PSR-7 (a transient, never-stored empty Uri when none is set, so hasUri() remains unaffected by calling this)
public
getUri() : Uri
Return values
UrigetUriAsString()
Get URI as string
public
getUriAsString() : string
Return values
stringgetUriString()
Get the request URI
public
getUriString() : string
Return values
stringhasAuth()
Has auth object
public
hasAuth() : bool
Return values
boolhasBody()
Has a body
public
hasBody() : bool
Return values
boolhasBodyContent()
Has body content
public
hasBodyContent() : bool
Return values
boolhasData()
Has data
public
hasData() : bool
Return values
boolhasFiles()
Return whether or not the request has FILES
public
hasFiles() : bool
Return values
boolhasHeader()
Has a header
public
hasHeader(string $name) : bool
Parameters
- $name : string
Return values
boolhasHeaders()
Determine if there are headers
public
hasHeaders() : bool
Return values
boolhasParsedData()
Has parsed data
public
hasParsedData() : bool
Return values
boolhasQueryData()
Has query data
public
hasQueryData() : bool
This always returns false now: the QUERY_STRING re-parse that used to populate $queryData was removed. Check getQuery() instead (e.g. !empty($this->getQuery())), which reads directly from PHP's native $_GET.
Return values
boolhasRawData()
Has raw data
public
hasRawData() : bool
Return values
boolhasUri()
Has URI
public
hasUri() : bool
Return values
boolisConnect()
Return whether or not the method is CONNECT
public
isConnect() : bool
Return values
boolisDelete()
Return whether or not the method is DELETE
public
isDelete() : bool
Return values
boolisGet()
Return whether or not the method is GET
public
isGet() : bool
Return values
boolisHead()
Return whether or not the method is HEAD
public
isHead() : bool
Return values
boolisOptions()
Return whether or not the method is OPTIONS
public
isOptions() : bool
Return values
boolisPatch()
Return whether or not the method is PATCH
public
isPatch() : bool
Return values
boolisPost()
Return whether or not the method is POST
public
isPost() : bool
Return values
boolisPut()
Return whether or not the method is PUT
public
isPut() : bool
Return values
boolisSecure()
Return whether or not the request is secure
public
isSecure() : bool
Return values
boolisTrace()
Return whether or not the method is TRACE
public
isTrace() : bool
Return values
boolremoveBody()
Remove the body
public
removeBody() : AbstractRequestResponse
Return values
AbstractRequestResponseremoveHeader()
Remove a header
public
removeHeader(string $name) : AbstractRequestResponse
Parameters
- $name : string
Return values
AbstractRequestResponseremoveHeaders()
Remove all headers
public
removeHeaders() : AbstractRequestResponse
Return values
AbstractRequestResponsesetAuth()
Set the auth object
public
setAuth(Auth $auth) : Request
Parameters
- $auth : Auth
Return values
RequestsetBasePath()
Set the base path
public
setBasePath([string|null $path = null ]) : Request
Parameters
- $path : string|null = null
Return values
RequestsetBody()
Set the body
public
setBody(string|Body $body) : AbstractRequestResponse
Parameters
- $body : string|Body
Return values
AbstractRequestResponsesetHeaders()
Set all headers (clear out any existing headers)
public
setHeaders(array<string|int, mixed> $headers) : AbstractRequestResponse
Parameters
- $headers : array<string|int, mixed>
Return values
AbstractRequestResponsesetUri()
Set URI
public
setUri(Uri|string $uri) : AbstractRequest
Parameters
- $uri : Uri|string
Tags
Return values
AbstractRequestwithAddedHeader()
Return an instance with the specified header value(s) appended, per PSR-7
public
withAddedHeader(string $name, mixed $value) : static
Parameter is typed mixed (rather than string|array) only to satisfy PSR-7's
untyped MessageInterface::withAddedHeader() signature per PHP's LSP variance
rules; the supported values remain a string or an array of strings.
Parameters
- $name : string
- $value : mixed
Return values
staticwithAttribute()
Return an instance with the specified attribute set, per PSR-7
public
withAttribute(string $name, mixed $value) : static
Parameters
- $name : string
- $value : mixed
Return values
staticwithBody()
Return an instance with the specified body, per PSR-7
public
withBody(Body|StreamInterface $body) : static
Parameters
- $body : Body|StreamInterface
Return values
staticwithCookieParams()
Return an instance with the specified cookie params, per PSR-7
public
withCookieParams(array<string|int, mixed> $cookies) : static
Parameters
- $cookies : array<string|int, mixed>
Return values
staticwithHeader()
Return an instance with the specified header, replacing any existing values, per PSR-7
public
withHeader(string $name, mixed $value) : static
Parameter is typed mixed (rather than string|array) only to satisfy PSR-7's
untyped MessageInterface::withHeader() signature per PHP's LSP variance rules;
the supported values remain a string or an array of strings.
Parameters
- $name : string
- $value : mixed
Return values
staticwithMethod()
Return a new request with the specified request method
public
withMethod(string $method) : static
Parameters
- $method : string
Return values
staticwithoutAttribute()
Return an instance without the specified attribute, per PSR-7
public
withoutAttribute(string $name) : static
Parameters
- $name : string
Return values
staticwithoutHeader()
Return an instance without the specified header, per PSR-7
public
withoutHeader(string $name) : static
Parameters
- $name : string
Return values
staticwithParsedBody()
Return an instance with the specified parsed body, per PSR-7
public
withParsedBody(array<string|int, mixed>|object|null $data) : static
Parameters
- $data : array<string|int, mixed>|object|null
Return values
staticwithProtocolVersion()
Return an instance with the specified HTTP protocol version, per PSR-7
public
withProtocolVersion(string $version) : static
Parameters
- $version : string
Return values
staticwithQueryParams()
Return an instance with the specified query params, per PSR-7
public
withQueryParams(array<string|int, mixed> $query) : static
Parameters
- $query : array<string|int, mixed>
Return values
staticwithRequestTarget()
Return an instance with the specified request target, per PSR-7
public
withRequestTarget(string $requestTarget) : static
Parameters
- $requestTarget : string
Return values
staticwithUploadedFiles()
Return an instance with the specified uploaded files, per PSR-7
public
withUploadedFiles(array<string|int, mixed> $uploadedFiles) : static
Parameters
- $uploadedFiles : array<string|int, mixed>
Return values
staticwithUri()
Return an instance with the specified URI, per PSR-7
public
withUri(UriInterface $uri[, bool $preserveHost = false ]) : static
Parameters
- $uri : UriInterface
- $preserveHost : bool = false