trait HasRequestProperties

Traits

Properties

protected list<array<string, mixed>> $cookies

The request cookies and their attributes.

from  HasCookies
protected int|null $delay

The request delay in milliseconds.

from  HasDelay
protected ArrayRepository|null $headerRepository

The request headers.

from  HasHeaders
protected MiddlewarePipeline|null $middlewarePipeline

The request middleware pipeline.

from  HasMiddleware
protected ArrayRepository|null $optionRepository

The request options.

from  HasOptions
protected ArrayRepository|null $queryRepository

The request query parameters.

from  HasQuery
protected string|null $queryString

The already-encoded query string override.

from  HasQuery
protected RetryPolicy|null $retryPolicy

The request retry policy.

from  HasRetryPolicy
protected array<array-key, mixed> $urlParameters

The parameters substituted into URL templates.

from  HasUrlParameters

Methods

withCookie(SetCookie $cookie)

Specify a cookie and its attributes for the request.

withCookies(array $cookies, string $domain)

Specify cookies that should be included with the request.

array
cookies()

Get the request cookies and their attributes.

delay(int $milliseconds)

Delay the request by the given milliseconds.

from  HasDelay
int|null
delayMilliseconds()

Get the request delay in milliseconds.

from  HasDelay
int|null
defaultDelay()

Resolve the default request delay.

from  HasDelay
array
headers()

Get the request headers.

bool
hasHeader(string $name)

Determine if the request contains the given header.

withHeaders(array $headers)

Add headers to the request.

withHeader(string $name, mixed $value)

Add a header to the request.

replaceHeaders(array $headers)

Replace matching headers on the request.

withoutHeader(string $name)

Remove a header from the request.

withoutHeaders(array $names)

Remove the given headers from the request.

contentType(string $contentType)

Specify the request content type.

acceptJson()

Indicate that JSON should be returned by the server.

accept(string $contentType)

Indicate the type of content that should be returned by the server.

withUserAgent(bool|string $userAgent)

Specify the request user agent.

array
defaultHeaders()

Resolve the default request headers.

headerRepository()

Get the request header repository.

middleware()

Get the request middleware pipeline.

array
options()

Get the request options.

withOptions(array $options)

Add options to the request.

withoutOptions(array|string $keys)

Remove the given options from the request.

maxRedirects(int $max)

Specify the maximum number of redirects to allow.

withoutRedirecting()

Indicate that redirects should not be followed.

withoutVerifying()

Indicate that TLS certificates should not be verified.

sink(resource|StreamInterface|string $to)

Specify where the response body should be stored.

timeout(float|int $seconds)

Specify the request timeout in seconds.

connectTimeout(float|int $seconds)

Specify the connection timeout in seconds.

withTelescopeTags(array $tags)

Add Telescope tags to the request.

withoutTelescope()

Disable Telescope recording for the request.

array
defaultOptions()

Resolve the default request options.

optionRepository()

Get the request option repository.

string|null
queryString()

Get the raw query string override, without a leading question mark.

from  HasQuery
withQueryString(string $query)

Replace the base URL and endpoint query string.

from  HasQuery
array
queryParameters()

Get the request query parameters.

from  HasQuery
withQueryParameters(array $parameters)

Add query parameters to the request.

from  HasQuery
withoutQueryParameters(array|string $keys)

Remove the given query parameters from the request.

from  HasQuery
array
defaultQuery()

Resolve the default request query parameters.

from  HasQuery
string|null
defaultQueryString()

Resolve the default raw query string override.

from  HasQuery
queryRepository()

Get the request query repository.

from  HasQuery
retry(array|int $times, Closure|int $sleepMilliseconds = 0, callable|null $when = null, bool $throw = true)

Specify the number of times the request should be attempted.

retryPolicy()

Get the request retry policy.

defaultRetryPolicy()

Resolve the default retry policy.

array
urlParameters()

Get the parameters substituted into URL templates.

withUrlParameters(array $parameters = [])

Specify the URL parameters that can be substituted into the request URL.

Details

in HasCookies at line 25
HasCookies withCookie(SetCookie $cookie)

Specify a cookie and its attributes for the request.

Parameters

SetCookie $cookie

Return Value

HasCookies

in HasCookies at line 46
HasCookies withCookies(array $cookies, string $domain)

Specify cookies that should be included with the request.

Parameters

array $cookies
string $domain

Return Value

HasCookies

in HasCookies at line 60
array cookies()

Get the request cookies and their attributes.

Return Value

array

in HasDelay at line 21
HasDelay delay(int $milliseconds)

Delay the request by the given milliseconds.

Parameters

int $milliseconds

Return Value

HasDelay

in HasDelay at line 35
int|null delayMilliseconds()

Get the request delay in milliseconds.

Return Value

int|null

in HasDelay at line 43
protected int|null defaultDelay()

Resolve the default request delay.

Return Value

int|null

in HasHeaders at line 21
array headers()

Get the request headers.

Return Value

array

in HasHeaders at line 29
bool hasHeader(string $name)

Determine if the request contains the given header.

Parameters

string $name

Return Value

bool

in HasHeaders at line 46
HasHeaders withHeaders(array $headers)

Add headers to the request.

Parameters

array $headers

Return Value

HasHeaders

in HasHeaders at line 58
HasHeaders withHeader(string $name, mixed $value)

Add a header to the request.

Parameters

string $name
mixed $value

Return Value

HasHeaders

in HasHeaders at line 69
HasHeaders replaceHeaders(array $headers)

Replace matching headers on the request.

Parameters

array $headers

Return Value

HasHeaders

in HasHeaders at line 97
HasHeaders withoutHeader(string $name)

Remove a header from the request.

Parameters

string $name

Return Value

HasHeaders

in HasHeaders at line 108
HasHeaders withoutHeaders(array $names)

Remove the given headers from the request.

Parameters

array $names

Return Value

HasHeaders

in HasHeaders at line 126
HasHeaders contentType(string $contentType)

Specify the request content type.

Parameters

string $contentType

Return Value

HasHeaders

in HasHeaders at line 136
HasHeaders acceptJson()

Indicate that JSON should be returned by the server.

Return Value

HasHeaders

in HasHeaders at line 146
HasHeaders accept(string $contentType)

Indicate the type of content that should be returned by the server.

Parameters

string $contentType

Return Value

HasHeaders

in HasHeaders at line 156
HasHeaders withUserAgent(bool|string $userAgent)

Specify the request user agent.

Parameters

bool|string $userAgent

Return Value

HasHeaders

in HasHeaders at line 166
protected array defaultHeaders()

Resolve the default request headers.

Return Value

array

in HasHeaders at line 174
protected ArrayRepository headerRepository()

Get the request header repository.

Return Value

ArrayRepository

in HasMiddleware at line 19
MiddlewarePipeline middleware()

Get the request middleware pipeline.

Return Value

MiddlewarePipeline

in HasOptions at line 23
array options()

Get the request options.

Return Value

array

in HasOptions at line 34
HasOptions withOptions(array $options)

Add options to the request.

Parameters

array $options

Return Value

HasOptions

in HasOptions at line 47
HasOptions withoutOptions(array|string $keys)

Remove the given options from the request.

Parameters

array|string $keys

Return Value

HasOptions

in HasOptions at line 59
HasOptions maxRedirects(int $max)

Specify the maximum number of redirects to allow.

Parameters

int $max

Return Value

HasOptions

in HasOptions at line 77
HasOptions withoutRedirecting()

Indicate that redirects should not be followed.

Return Value

HasOptions

in HasOptions at line 87
HasOptions withoutVerifying()

Indicate that TLS certificates should not be verified.

Return Value

HasOptions

in HasOptions at line 98
HasOptions sink(resource|StreamInterface|string $to)

Specify where the response body should be stored.

Parameters

resource|StreamInterface|string $to

Return Value

HasOptions

in HasOptions at line 108
HasOptions timeout(float|int $seconds)

Specify the request timeout in seconds.

Parameters

float|int $seconds

Return Value

HasOptions

in HasOptions at line 118
HasOptions connectTimeout(float|int $seconds)

Specify the connection timeout in seconds.

Parameters

float|int $seconds

Return Value

HasOptions

in HasOptions at line 129
HasOptions withTelescopeTags(array $tags)

Add Telescope tags to the request.

Parameters

array $tags

Return Value

HasOptions

in HasOptions at line 139
HasOptions withoutTelescope()

Disable Telescope recording for the request.

Return Value

HasOptions

in HasOptions at line 149
protected array defaultOptions()

Resolve the default request options.

Return Value

array

in HasOptions at line 157
protected ArrayRepository optionRepository()

Get the request option repository.

Return Value

ArrayRepository

in HasQuery at line 24
string|null queryString()

Get the raw query string override, without a leading question mark.

Return Value

string|null

in HasQuery at line 32
HasQuery withQueryString(string $query)

Replace the base URL and endpoint query string.

Parameters

string $query

Return Value

HasQuery

in HasQuery at line 44
array queryParameters()

Get the request query parameters.

Return Value

array

in HasQuery at line 55
HasQuery withQueryParameters(array $parameters)

Add query parameters to the request.

Parameters

array $parameters

Return Value

HasQuery

in HasQuery at line 71
HasQuery withoutQueryParameters(array|string $keys)

Remove the given query parameters from the request.

Only values added through the query parameter methods are removed. Values embedded in the base URL, endpoint or raw query string are unchanged.

Parameters

array|string $keys

Return Value

HasQuery

in HasQuery at line 83
protected array defaultQuery()

Resolve the default request query parameters.

Return Value

array

in HasQuery at line 91
protected string|null defaultQueryString()

Resolve the default raw query string override.

Return Value

string|null

in HasQuery at line 99
protected ArrayRepository queryRepository()

Get the request query repository.

Return Value

ArrayRepository

in HasRetryPolicy at line 23
HasRetryPolicy retry(array|int $times, Closure|int $sleepMilliseconds = 0, callable|null $when = null, bool $throw = true)

Specify the number of times the request should be attempted.

Parameters

array|int $times
Closure|int $sleepMilliseconds
callable|null $when
bool $throw

Return Value

HasRetryPolicy

in HasRetryPolicy at line 37
RetryPolicy|null retryPolicy()

Get the request retry policy.

Return Value

RetryPolicy|null

in HasRetryPolicy at line 45
protected RetryPolicy|null defaultRetryPolicy()

Resolve the default retry policy.

Return Value

RetryPolicy|null

in HasUrlParameters at line 21
array urlParameters()

Get the parameters substituted into URL templates.

Return Value

array

in HasUrlParameters at line 32
HasUrlParameters withUrlParameters(array $parameters = [])

Specify the URL parameters that can be substituted into the request URL.

Parameters

array $parameters

Return Value

HasUrlParameters