trait HasRequestProperties

Traits

Properties

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

The request cookies and their attributes.

from  HasCookies
protected IntegerRepository|null $delayRepository

The request delay.

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

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
delayRepository()

Get the request delay repository.

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.

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.

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

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 22
HasDelay delay(int $milliseconds)

Delay the request by the given milliseconds.

Parameters

int $milliseconds

Return Value

HasDelay

in HasDelay at line 36
int|null delayMilliseconds()

Get the request delay in milliseconds.

Return Value

int|null

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

Resolve the default request delay.

Return Value

int|null

in HasDelay at line 52
protected IntegerRepository delayRepository()

Get the request delay repository.

Return Value

IntegerRepository

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 contentType(string $contentType)

Specify the request content type.

Parameters

string $contentType

Return Value

HasHeaders

in HasHeaders at line 107
HasHeaders acceptJson()

Indicate that JSON should be returned by the server.

Return Value

HasHeaders

in HasHeaders at line 117
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 127
HasHeaders withUserAgent(bool|string $userAgent)

Specify the request user agent.

Parameters

bool|string $userAgent

Return Value

HasHeaders

in HasHeaders at line 137
protected array defaultHeaders()

Resolve the default request headers.

Return Value

array

in HasHeaders at line 145
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 46
HasOptions maxRedirects(int $max)

Specify the maximum number of redirects to allow.

Parameters

int $max

Return Value

HasOptions

in HasOptions at line 64
HasOptions withoutRedirecting()

Indicate that redirects should not be followed.

Return Value

HasOptions

in HasOptions at line 74
HasOptions withoutVerifying()

Indicate that TLS certificates should not be verified.

Return Value

HasOptions

in HasOptions at line 85
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 95
HasOptions timeout(float|int $seconds)

Specify the request timeout in seconds.

Parameters

float|int $seconds

Return Value

HasOptions

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

Specify the connection timeout in seconds.

Parameters

float|int $seconds

Return Value

HasOptions

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

Add Telescope tags to the request.

Parameters

array $tags

Return Value

HasOptions

in HasOptions at line 126
HasOptions withoutTelescope()

Disable Telescope recording for the request.

Return Value

HasOptions

in HasOptions at line 136
protected array defaultOptions()

Resolve the default request options.

Return Value

array

in HasOptions at line 144
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 67
protected array defaultQuery()

Resolve the default request query parameters.

Return Value

array

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

Resolve the default raw query string override.

Return Value

string|null

in HasQuery at line 83
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 retryPolicy()

Get the request retry policy.

Return Value

RetryPolicy