Documentation

StreamClient extends HTTPClientAbstract
in package

A http client via PHP streams

(I'm not exactly sure why I'm keeping this - use CurlClient in production)

Tags
see
file_get_contents()
see
stream_context_create()

Table of Contents

Properties

$logger  : LoggerInterface
$options  : HTTPOptions|SettingsContainerInterface
$responseFactory  : ResponseFactoryInterface
$streamFactory  : StreamFactoryInterface|null

Methods

__construct()  : mixed
HTTPClientAbstract constructor.
sendRequest()  : ResponseInterface
setLogger()  : static
Sets a PSR-3 Logger
setResponseFactory()  : static
Sets a PSR-17 response factory
setStreamFactory()  : static
Sets a PSR-17 stream factory
createResponse()  : ResponseInterface
getContextOptions()  : array<string|int, mixed>
getRequestHeaders()  : array<string|int, mixed>

Properties

Methods

__construct()

HTTPClientAbstract constructor.

public __construct(ResponseFactoryInterface $responseFactory[, HTTPOptions|SettingsContainerInterface $options = new HTTPOptions() ][, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
$responseFactory : ResponseFactoryInterface
$options : HTTPOptions|SettingsContainerInterface = new HTTPOptions()
$logger : LoggerInterface = new NullLogger()

sendRequest()

public sendRequest(RequestInterface $request) : ResponseInterface
Parameters
$request : RequestInterface
Tags
inheritDoc
throws
Exception|ClientException
Return values
ResponseInterface

setLogger()

Sets a PSR-3 Logger

public setLogger(LoggerInterface $logger) : static
Parameters
$logger : LoggerInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

setResponseFactory()

Sets a PSR-17 response factory

public setResponseFactory(ResponseFactoryInterface $responseFactory) : static
Parameters
$responseFactory : ResponseFactoryInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

setStreamFactory()

Sets a PSR-17 stream factory

public setStreamFactory(StreamFactoryInterface $streamFactory) : static
Parameters
$streamFactory : StreamFactoryInterface
Tags
inheritDoc
codeCoverageIgnore
Return values
static

createResponse()

protected createResponse(array<string|int, string> $headers) : ResponseInterface
Parameters
$headers : array<string|int, string>
Return values
ResponseInterface

getContextOptions()

protected getContextOptions(RequestInterface $request) : array<string|int, mixed>
Parameters
$request : RequestInterface
Return values
array<string|int, mixed>

getRequestHeaders()

protected getRequestHeaders(RequestInterface $request) : array<string|int, mixed>
Parameters
$request : RequestInterface
Return values
array<string|int, mixed>

        
On this page

Search results