Documentation

Request extends AbstractRequest
in package
implements ServerRequestInterface

HTTP server request class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
6.0.0

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 = []

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 = []

$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

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
throws
Exception|Exception

__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
bool

acceptsHtml()

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
bool

acceptsJson()

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
bool

acceptsXml()

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
bool

create()

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
throws
Exception|Exception
Return values
Request

createWithBasePath()

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
Request

decodeBodyContent()

Decode the body

public decodeBodyContent([string|null $body = null ]) : Body
Parameters
$body : string|null = null
Return values
Body

getAttribute()

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>

getBasePath()

Get the base path

public getBasePath() : string
Return values
string

getBody()

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
Body

getBodyContentLength()

Get body content length

public getBodyContentLength([bool $mb = false ]) : int
Parameters
$mb : bool = false
Return values
int

getCookie()

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>|null

getCookieParams()

Get the cookie params, per PSR-7

public getCookieParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDelete()

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>|null

getDocumentRoot()

Get the document root

public getDocumentRoot() : string|null
Return values
string|null

getEnv()

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>|null

getFiles()

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>|null

getFullHost()

Get host with port

public getFullHost() : string
Return values
string

getFullUriString()

Get the full request URI, including base path

public getFullUriString() : string
Return values
string

getHeader()

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
string

getHeaderObject()

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
string

getHeaderValue()

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|null

getHost()

Get host (without port)

public getHost() : string
Return values
string

getIp()

Get client's IP

public getIp([bool $proxy = true ]) : string
Parameters
$proxy : bool = true
Return values
string

getMethod()

Get the method

public getMethod() : string
Return values
string

getParsedBody()

Get the parsed body, per PSR-7

public getParsedBody() : array<string|int, mixed>|object|null
Return values
array<string|int, mixed>|object|null

getParsedData()

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>|null

getPatch()

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>|null

getPort()

Get the server port

public getPort() : string|null
Return values
string|null

getPost()

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>|null

getPreferredType()

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|null

getProtocolVersion()

Get the HTTP protocol version, per PSR-7

public getProtocolVersion() : string
Return values
string

getPut()

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>|null

getQuery()

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>|null

getQueryData()

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>|null

getQueryParams()

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|null

getRequestTarget()

Get the request target, per PSR-7 (path + query, or '/' with no URI, unless overridden)

public getRequestTarget() : string
Return values
string

getScheme()

Get scheme

public getScheme() : string
Return values
string

getSegment()

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|null

getSegments()

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>|null

getServerParams()

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
Uri

getUriAsString()

Get URI as string

public getUriAsString() : string
Return values
string

getUriString()

Get the request URI

public getUriString() : string
Return values
string

hasAuth()

Has auth object

public hasAuth() : bool
Return values
bool

hasData()

Has data

public hasData() : bool
Return values
bool

hasFiles()

Return whether or not the request has FILES

public hasFiles() : bool
Return values
bool

hasHeader()

Has a header

public hasHeader(string $name) : bool
Parameters
$name : string
Return values
bool

hasParsedData()

Has parsed data

public hasParsedData() : bool
Return values
bool

hasQueryData()

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
bool

hasRawData()

Has raw data

public hasRawData() : bool
Return values
bool

isConnect()

Return whether or not the method is CONNECT

public isConnect() : bool
Return values
bool

isDelete()

Return whether or not the method is DELETE

public isDelete() : bool
Return values
bool

isGet()

Return whether or not the method is GET

public isGet() : bool
Return values
bool

isHead()

Return whether or not the method is HEAD

public isHead() : bool
Return values
bool

isOptions()

Return whether or not the method is OPTIONS

public isOptions() : bool
Return values
bool

isPatch()

Return whether or not the method is PATCH

public isPatch() : bool
Return values
bool

isPost()

Return whether or not the method is POST

public isPost() : bool
Return values
bool

isPut()

Return whether or not the method is PUT

public isPut() : bool
Return values
bool

isSecure()

Return whether or not the request is secure

public isSecure() : bool
Return values
bool

isTrace()

Return whether or not the method is TRACE

public isTrace() : bool
Return values
bool

setBasePath()

Set the base path

public setBasePath([string|null $path = null ]) : Request
Parameters
$path : string|null = null
Return values
Request

withAddedHeader()

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
static

withAttribute()

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
static

withBody()

Return an instance with the specified body, per PSR-7

public withBody(Body|StreamInterface $body) : static
Parameters
$body : Body|StreamInterface
Return values
static

withCookieParams()

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
static

withHeader()

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
static

withMethod()

Return a new request with the specified request method

public withMethod(string $method) : static
Parameters
$method : string
Return values
static

withoutAttribute()

Return an instance without the specified attribute, per PSR-7

public withoutAttribute(string $name) : static
Parameters
$name : string
Return values
static

withoutHeader()

Return an instance without the specified header, per PSR-7

public withoutHeader(string $name) : static
Parameters
$name : string
Return values
static

withParsedBody()

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
static

withProtocolVersion()

Return an instance with the specified HTTP protocol version, per PSR-7

public withProtocolVersion(string $version) : static
Parameters
$version : string
Return values
static

withQueryParams()

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
static

withRequestTarget()

Return an instance with the specified request target, per PSR-7

public withRequestTarget(string $requestTarget) : static
Parameters
$requestTarget : string
Return values
static

withUploadedFiles()

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
static

withUri()

Return an instance with the specified URI, per PSR-7

public withUri(UriInterface $uri[, bool $preserveHost = false ]) : static
Parameters
$uri : UriInterface
$preserveHost : bool = false
Return values
static

        
On this page

Search results