HumHub Documentation (unofficial)

Psr18Client
in package
implements ClientInterface, RequestFactoryInterface, StreamFactoryInterface, UriFactoryInterface, ResetInterface

FinalYes

An adapter to turn a Symfony HttpClientInterface into a PSR-18 ClientInterface.

Run "composer require psr/http-client" to install the base ClientInterface. Run "composer require nyholm/psr7" to install an efficient implementation of response and stream factories with flex-provided autowiring aliases.

Tags
author

Nicolas Grekas p@tchwork.com

Table of Contents

Interfaces

ClientInterface
RequestFactoryInterface
StreamFactoryInterface
UriFactoryInterface
ResetInterface
Provides a way to reset an object to its initial state.

Properties

$client  : mixed
$responseFactory  : mixed
$streamFactory  : mixed

Methods

__construct()  : mixed
createRequest()  : RequestInterface
Create a new request.
createStream()  : StreamInterface
Create a new stream from a string.
createStreamFromFile()  : StreamInterface
Create a stream from an existing file.
createStreamFromResource()  : StreamInterface
Create a new stream from an existing resource.
createUri()  : UriInterface
Create a new URI.
reset()  : mixed
sendRequest()  : ResponseInterface
Sends a PSR-7 request and returns a PSR-7 response.

Properties

Methods

createRequest()

Create a new request.

public createRequest(string $method, mixed $uri) : RequestInterface
Parameters
$method : string

The HTTP method associated with the request.

$uri : mixed

The URI associated with the request. If the value is a string, the factory MUST create a UriInterface instance based on it.

Return values
RequestInterface

createStream()

Create a new stream from a string.

public createStream([string $content = '' ]) : StreamInterface
Parameters
$content : string = ''

String content with which to populate the stream.

Return values
StreamInterface

createStreamFromFile()

Create a stream from an existing file.

public createStreamFromFile(string $filename[, string $mode = 'r' ]) : StreamInterface
Parameters
$filename : string

Filename or stream URI to use as basis of stream.

$mode : string = 'r'

Mode with which to open the underlying filename/stream.

Return values
StreamInterface

createStreamFromResource()

Create a new stream from an existing resource.

public createStreamFromResource(mixed $resource) : StreamInterface
Parameters
$resource : mixed

PHP resource to use as basis of stream.

Return values
StreamInterface

        
On this page

Search results