Methods |
public
static
|
getContentLength(
Arrayable<string, string[]|string>|iterable<string, string[]|string>|MessageInterface|string $headersOrPayload,
): int<0, max>|null
Get the value of a Content-Length header, or null if it is not set
Get the value of a Content-Length header, or null if it is not set
|
#
|
public
static
|
getMultipartBoundary(
Arrayable<string, string[]|string>|iterable<string, string[]|string>|MessageInterface|string $headersOrPayload,
): ?string
Get the value of a Content-Type header's boundary parameter, or null if
it is not set
Get the value of a Content-Type header's boundary parameter, or null if
it is not set
|
#
|
public
static
|
getPreferences(
Arrayable<string, string[]|string>|iterable<string, string[]|string>|MessageInterface|string $headersOrPayload,
): array<string, array{value: string, parameters: array<string, string>}>
Get preferences applied via one or more Prefer headers as per [RFC7240]
Get preferences applied via one or more Prefer headers as per [RFC7240]
|
#
|
public
static
|
mergePreferences(array<string, array{value: string, parameters?: array<string, string>}|string> $preferences): string
Merge preferences into a Prefer header value as per [RFC7240]
Merge preferences into a Prefer header value as per [RFC7240]
|
#
|
public
static
|
getRetryAfter(
Arrayable<string, string[]|string>|iterable<string, string[]|string>|MessageInterface|string $headersOrPayload,
): int<0, max>|null
Get the value of a Retry-After header in seconds from the current time,
or null if it has an invalid value or is not set
Get the value of a Retry-After header in seconds from the current time,
or null if it has an invalid value or is not set
|
#
|
public
static
|
getParameters(string $value, bool $firstIsParameter = false, bool $unquote = true, bool $strict = false): string[]
Get semicolon-delimited parameters from the value of a header
Get semicolon-delimited parameters from the value of a header
|
#
|
public
static
|
mergeParameters(string[] $parameters): string
Merge parameters into a semicolon-delimited header value
Merge parameters into a semicolon-delimited header value
|
#
|
public
static
|
isRequestMethod(string $method): bool
Check if a string is a recognised HTTP request method
Check if a string is a recognised HTTP request method
|
#
|
public
static
|
isAuthorityForm(string $target): bool
Check if a string contains only a host and port number, separated by a
colon
Check if a string contains only a host and port number, separated by a
colon
[RFC9112] Section 3.2.3 ("authority-form"): "When making a CONNECT
request to establish a tunnel through one or more proxies, a client MUST
send only the host and port of the tunnel destination as the
request-target."
|
#
|
public
static
|
mediaTypeIs(string $type, string $mimeType): bool
Check if a media type is a match for the given MIME type
Check if a media type is a match for the given MIME type
Structured syntax suffixes (e.g. +json in application/vnd.api+json )
are parsed as per [RFC6838] Section 4.2.8 ("Structured Syntax Name
Suffixes").
|
#
|
public
static
|
getDate(?DateTimeInterface $date = null): string
Get an HTTP date as per [RFC9110] Section 5.6.7 ("Date/Time Formats")
Get an HTTP date as per [RFC9110] Section 5.6.7 ("Date/Time Formats")
|
#
|
public
static
|
getProduct(): string
Get a product identifier suitable for User-Agent and Server headers as
per [RFC9110] Section 10.1.5 ("User-Agent")
Get a product identifier suitable for User-Agent and Server headers as
per [RFC9110] Section 10.1.5 ("User-Agent")
|
#
|
public
static
|
getMultipartMediaType(MultipartStreamInterface $stream): string
Get the media type of a multipart stream
Get the media type of a multipart stream
|
#
|
public
static
|
maybeQuoteString(string $string): string
Escape and double-quote a string unless it is a valid HTTP token, as per
[RFC9110] Section 5.6.4 ("Quoted Strings")
Escape and double-quote a string unless it is a valid HTTP token, as per
[RFC9110] Section 5.6.4 ("Quoted Strings")
|
#
|
public
static
|
quoteString(string $string): string
Escape and double-quote a string as per [RFC9110] Section 5.6.4 ("Quoted
Strings")
Escape and double-quote a string as per [RFC9110] Section 5.6.4 ("Quoted
Strings")
|
#
|
public
static
|
unquoteString(string $string): string
Unescape and remove quotes from a string as per [RFC9110] Section 5.6.4
("Quoted Strings")
Unescape and remove quotes from a string as per [RFC9110] Section 5.6.4
("Quoted Strings")
|
#
|
public
static
|
mergeQuery<T is RequestInterface|UriInterface|Stringable|string>(
T $value,
mixed[] $data,
int-mask-of<HttpUtil::DATA_*> $flags = HttpUtil::DATA_PRESERVE_NUMERIC_KEYS | HttpUtil::DATA_PRESERVE_STRING_KEYS,
?DateFormatterInterface $dateFormatter = null,
): (T is RequestInterface|UriInterface ? T : Uri)
Merge values into the query string of a request or URI
Merge values into the query string of a request or URI
|
#
|
public
static
|
replaceQuery<T is RequestInterface|UriInterface|Stringable|string>(
T $value,
mixed[] $data,
int-mask-of<HttpUtil::DATA_*> $flags = HttpUtil::DATA_PRESERVE_NUMERIC_KEYS | HttpUtil::DATA_PRESERVE_STRING_KEYS,
?DateFormatterInterface $dateFormatter = null,
): (T is RequestInterface|UriInterface ? T : Uri)
Replace the query string of a request or URI with the given values
Replace the query string of a request or URI with the given values
|
#
|
public
static
|
getStreamContents(StreamInterface $from): string
Get the contents of a stream
Get the contents of a stream
|
#
|
public
static
|
copyStream(StreamInterface $from, StreamInterface $to): void
Copy the contents of one stream to another
Copy the contents of one stream to another
|
#
|
public
static
|
getNameValuePairs(iterable<array{name: string, value: string}> $items): iterable<string, string>
Iterate over name-value pairs in arrays with "name" and "value" keys
Iterate over name-value pairs in arrays with "name" and "value" keys
|
#
|