Documentation Packages Support

Http Server ⋅ RequestBody

RequestBody extends Payload and allows streamed and buffered access to an InputStream. Additionally, it allows increasing the body size limit dynamically and allows access to the request trailers.

Note that RequestBody itself doesn’t provide parsing of form data. You can use amphp/http-server-form-parser if you need it.

Constructor

public function __construct(
    InputStream $stream,
    ?callable $upgradeSize = null
)

Parameters

InputStream $stream Request payload.
callable
null
$upgradeSize Callback used to increase the maximum size of the body.
Promise
null
$trailers Promise for trailing headers.

increaseSizeLimit(int $limit): void

Increases the size limit dynamically if an $upgradeSize callback is present. Otherwise this is a no-op.