Documentation

PhpStreamRequestFactory
in package
implements StreamRequestFactoryInterface

Factory used to create fopen streams using PHP's http and https stream wrappers

Note: PHP's http stream wrapper only supports streaming downloads. It does not support streaming uploads.

Table of Contents

Interfaces

StreamRequestFactoryInterface
Interface used for creating streams from requests

Properties

$context  : resource
$contextOptions  : array<string|int, mixed>
$lastResponseHeaders  : array<string|int, mixed>
$url  : Url

Methods

fromRequest()  : StreamInterface
Create a stream based on a request object
getLastResponseHeaders()  : array<string|int, mixed>
Get the last response headers received by the HTTP request
addBodyOptions()  : mixed
Add body (content) specific options to the context options
addDefaultContextOptions()  : mixed
Adds the default context options to the stream context options
addProxyOptions()  : mixed
Add proxy parameters to the context if needed
addSslOptions()  : mixed
Add SSL options to the stream context
createContext()  : mixed
Create a stream context
createResource()  : resource
Create a resource and check to ensure it was created successfully
createStream()  : StreamInterface
Create the stream for the request with the context options
processResponseHeaders()  : mixed
Process response headers
setContextValue()  : mixed
Set an option on the context and the internal options array
setUrl()  : mixed
Set the URL to use with the factory

Properties

$lastResponseHeaders

protected array<string|int, mixed> $lastResponseHeaders

Last response headers received by the HTTP request

Methods

fromRequest()

Create a stream based on a request object

public fromRequest(RequestInterface $request[, mixed $context = array() ][, array<string|int, mixed> $params = array() ]) : StreamInterface

The $params array can contain the following custom keys specific to the PhpStreamRequestFactory:

  • stream_class: The name of a class to create instead of a Guzzle\Stream\Stream object
Parameters
$request : RequestInterface

Base the stream on a request

$context : mixed = array()

A stream_context_options resource or array of parameters used to create a stream context.

$params : array<string|int, mixed> = array()

Optional array of parameters specific to the factory

Return values
StreamInterface

Returns a stream object

getLastResponseHeaders()

Get the last response headers received by the HTTP request

public getLastResponseHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

createContext()

Create a stream context

protected createContext(array<string|int, mixed> $params) : mixed
Parameters
$params : array<string|int, mixed>

Parameter array

createResource()

Create a resource and check to ensure it was created successfully

protected createResource(callable $callback) : resource
Parameters
$callback : callable

Closure to invoke that must return a valid resource

Tags
throws
RuntimeException

on error

Return values
resource

createStream()

Create the stream for the request with the context options

protected createStream(array<string|int, mixed> $params) : StreamInterface
Parameters
$params : array<string|int, mixed>

Parameters of the stream

Return values
StreamInterface

setContextValue()

Set an option on the context and the internal options array

protected setContextValue(string $wrapper, string $name, mixed $value[, bool $overwrite = false ]) : mixed
Parameters
$wrapper : string

Stream wrapper name of http

$name : string

Context name

$value : mixed

Context value

$overwrite : bool = false

Set to true to overwrite an existing value


        
On this page

Search results