Skip to content

Psr7DelegationTrait

Pure one-line delegations to the wrapped Nyholm\Psr7\ServerRequest.

Everything here is mechanical passthrough with no Quiote-specific behavior; methods that need to react to the change (e.g. withUri() re-syncing URL metadata) stay on WebRequest itself.

trait Psr7DelegationTrait

SourceRequest/Psr7DelegationTrait.php
MethodDescription
getAttribute(mixed $name, mixed $default = null): mixedReturns the named request attribute.
getAttributes(): array<string, mixed>
getBody(): StreamInterfaceReturns the wrapped request’s body stream.
getCookieParams(): array<string, mixed>
getHeader(mixed $name): arrayReturns every value of the named header, one entry per value.
getHeaderLine(mixed $name): stringReturns the named header’s values joined with commas.
getHeaders(): array<string, mixed>
getMethod(): stringReturns the HTTP method of the wrapped request, in the case it was received in.
[`getParsedBody(): array<string, mixed>object
getProtocolVersion(): stringReturns the HTTP protocol version of the wrapped PSR-7 request, e.g.
getQueryParams(): array<string, mixed>
getRequestTarget(): stringReturns the request target as it appears on the request line.
getServerParams(): array<string, mixed>
[`getUploadedFiles(): array<string, UploadedFileInterfacearray<int
getUri(): UriInterfaceReturns the wrapped request’s URI.
hasHeader(mixed $name): boolReports whether the wrapped request carries the named header, case-insensitively.
withAddedHeader(mixed $name, mixed $value): staticReturns a clone with the given value appended to the named header.
withAttribute(mixed $name, mixed $value): staticReturns a clone carrying the named request attribute.
withBody(StreamInterface $body): staticReturns a clone whose body is the given stream.
withCookieParams(array<string, mixed> $cookies): static
withHeader(mixed $name, mixed $value): staticReturns a clone with the named header replaced by the given value.
withMethod(mixed $method): staticReturns a clone using the given HTTP method.
[`withParsedBody(array<string, mixed>object
withProtocolVersion(mixed $version): staticReturns a clone carrying the given HTTP protocol version.
withQueryParams(array<string, mixed> $query): static
withRequestTarget(mixed $requestTarget): staticReturns a clone whose request line carries the given target verbatim.
[`withUploadedFiles(array<string, UploadedFileInterfacearray<int
withoutAttribute(mixed $name): staticReturns a clone with the named request attribute removed.
withoutHeader(mixed $name): staticReturns a clone with the named header removed.

public function getAttribute(mixed $name, mixed $default = null): mixed

Returns the named request attribute.

$default is returned when no attribute of that name has been set, which is how attributes put on the request by middleware are read without knowing whether that middleware ran.

ParameterTypeDescription
$namemixed
$defaultmixed

Returns mixed

public function getAttributes(): array<string, mixed>

Returns array``<``string``, ``mixed``>

public function getBody(): StreamInterface

Returns the wrapped request’s body stream.

The live stream, not a copy: reading from it advances the position seen by every other holder of this request.

Returns StreamInterface

public function getCookieParams(): array<string, mixed>

Returns array``<``string``, ``mixed``>

public function getHeader(mixed $name): array

Returns every value of the named header, one entry per value.

An empty array when the header is not present, per PSR-7.

ParameterTypeDescription
$namemixed

Returns array

public function getHeaderLine(mixed $name): string

Returns the named header’s values joined with commas.

An empty string when the header is not present, per PSR-7.

ParameterTypeDescription
$namemixed

Returns string

public function getHeaders(): array<string, mixed>

Returns array``<``string``, ``mixed``>

public function getMethod(): string

Returns the HTTP method of the wrapped request, in the case it was received in.

Returns string

public function getParsedBody(): array<string, mixed>|object|null

Returns array``<``string``, ``mixed``>``|``object``|``null

public function getProtocolVersion(): string

Returns the HTTP protocol version of the wrapped PSR-7 request, e.g.

1.1.

Returns string

public function getQueryParams(): array<string, mixed>

Returns array``<``string``, ``mixed``>

public function getRequestTarget(): string

Returns the request target as it appears on the request line.

The explicitly set target when there is one, otherwise the origin-form target derived from the URI, per PSR-7.

Returns string

public function getServerParams(): array<string, mixed>

Returns array``<``string``, ``mixed``>

public function getUploadedFiles(): array<string, UploadedFileInterface|array<int|string, mixed>>

Returns array``<``string``, UploadedFileInterface|``array``<``int``|``string``, ``mixed``>``>

public function getUri(): UriInterface

Returns the wrapped request’s URI.

Returns UriInterface

public function hasHeader(mixed $name): bool

Reports whether the wrapped request carries the named header, case-insensitively.

ParameterTypeDescription
$namemixed

Returns bool

public function withAddedHeader(mixed $name, mixed $value): static

Returns a clone with the given value appended to the named header.

Existing values of that header are kept. This request is left untouched and the clone starts with an empty parameter cache.

ParameterTypeDescription
$namemixed
$valuemixed

Returns static

public function withAttribute(mixed $name, mixed $value): static

Returns a clone carrying the named request attribute.

This request is left untouched, so middleware wanting the attribute to be visible downstream has to pass the returned instance on.

ParameterTypeDescription
$namemixed
$valuemixed

Returns static

public function withBody(StreamInterface $body): static

Returns a clone whose body is the given stream.

This request is left untouched; the clone starts with an empty parameter cache, so parameters are re-derived from the new body.

ParameterTypeDescription
$bodyStreamInterface

Returns static

public function withCookieParams(array<string, mixed> $cookies): static

ParameterTypeDescription
$cookiesarray``<``string``, ``mixed``>

Returns static

public function withHeader(mixed $name, mixed $value): static

Returns a clone with the named header replaced by the given value.

Any existing values of that header are discarded. This request is left untouched and the clone starts with an empty parameter cache.

ParameterTypeDescription
$namemixed
$valuemixed

Returns static

public function withMethod(mixed $method): static

Returns a clone using the given HTTP method.

The method is passed through as given; the wrapped PSR-7 request rejects a syntactically invalid one.

ParameterTypeDescription
$methodmixed

Returns static

public function withParsedBody(array<string, mixed>|object|null $data): static

ParameterTypeDescription
$data`array<string, mixed>object

Returns static

public function withProtocolVersion(mixed $version): static

Returns a clone carrying the given HTTP protocol version.

This request is left untouched; the clone wraps a new PSR-7 request and starts with an empty parameter cache.

ParameterTypeDescription
$versionmixed

Returns static

public function withQueryParams(array<string, mixed> $query): static

ParameterTypeDescription
$queryarray``<``string``, ``mixed``>

Returns static

public function withRequestTarget(mixed $requestTarget): static

Returns a clone whose request line carries the given target verbatim.

The URI is not touched, so the target may diverge from it.

ParameterTypeDescription
$requestTargetmixed

Returns static

public function withUploadedFiles(array<string, UploadedFileInterface|array<int|string, mixed>> $uploadedFiles): static

ParameterTypeDescription
$uploadedFilesarray``<``string``, UploadedFileInterface`array<int

Returns static

public function withoutAttribute(mixed $name): static

Returns a clone with the named request attribute removed.

A no-op clone when no attribute of that name is set.

ParameterTypeDescription
$namemixed

Returns static

public function withoutHeader(mixed $name): static

Returns a clone with the named header removed.

Each call clones the whole wrapped request; use the private bulk counterpart when removing several headers at once.

ParameterTypeDescription
$namemixed

Returns static