Class Guzzle\Stream\PhpStreamRequestFactory

InheritanceGuzzle\Stream\PhpStreamRequestFactory
ImplementsGuzzle\Stream\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.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$context resource Stream context options Guzzle\Stream\PhpStreamRequestFactory
$contextOptions array Stream context Guzzle\Stream\PhpStreamRequestFactory
$lastResponseHeaders array Last response headers received by the HTTP request Guzzle\Stream\PhpStreamRequestFactory
$url Guzzle\Http\Url Stream URL Guzzle\Stream\PhpStreamRequestFactory

Public Methods

Hide inherited methods

MethodDescriptionDefined By
fromRequest() {@inheritdoc} Guzzle\Stream\PhpStreamRequestFactory
getLastResponseHeaders() Get the last response headers received by the HTTP request Guzzle\Stream\PhpStreamRequestFactory

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
addBodyOptions() Add body (content) specific options to the context options Guzzle\Stream\PhpStreamRequestFactory
addDefaultContextOptions() Adds the default context options to the stream context options Guzzle\Stream\PhpStreamRequestFactory
addProxyOptions() Add proxy parameters to the context if needed Guzzle\Stream\PhpStreamRequestFactory
addSslOptions() Add SSL options to the stream context Guzzle\Stream\PhpStreamRequestFactory
createContext() Create a stream context Guzzle\Stream\PhpStreamRequestFactory
createResource() Create a resource and check to ensure it was created successfully Guzzle\Stream\PhpStreamRequestFactory
createStream() Create the stream for the request with the context options Guzzle\Stream\PhpStreamRequestFactory
processResponseHeaders() Process response headers Guzzle\Stream\PhpStreamRequestFactory
setContextValue() Set an option on the context and the internal options array Guzzle\Stream\PhpStreamRequestFactory
setUrl() Set the URL to use with the factory Guzzle\Stream\PhpStreamRequestFactory

Property Details

$context protected property

Stream context options

protected resource $context null
$contextOptions protected property

Stream context

protected array $contextOptions null
$lastResponseHeaders protected property

Last response headers received by the HTTP request

protected array $lastResponseHeaders null
$url protected property

Stream URL

protected Guzzle\Http\Url $url null

Method Details

addBodyOptions() protected method

Add body (content) specific options to the context options

protected void addBodyOptions ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface
addDefaultContextOptions() protected method

Adds the default context options to the stream context options

protected void addDefaultContextOptions ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request

addProxyOptions() protected method

Add proxy parameters to the context if needed

protected void addProxyOptions ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request

addSslOptions() protected method

Add SSL options to the stream context

protected void addSslOptions ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request

createContext() protected method

Create a stream context

protected void createContext ( array $params )
$params array

Parameter array

createResource() protected method

Create a resource and check to ensure it was created successfully

protected resource createResource ( $callback )
$callback callable

Closure to invoke that must return a valid resource

throws Guzzle\Common\Exception\RuntimeException

on error

createStream() protected method

Create the stream for the request with the context options

protected Guzzle\Stream\StreamInterface createStream ( array $params )
$params array

Parameters of the stream

fromRequest() public method

{@inheritdoc}

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
public void fromRequest ( Guzzle\Http\Message\RequestInterface $request, $context = [], array $params = [] )
$request
$context
$params
getLastResponseHeaders() public method

Get the last response headers received by the HTTP request

public array getLastResponseHeaders ( )
processResponseHeaders() protected method

Process response headers

protected void processResponseHeaders ( Guzzle\Stream\StreamInterface $stream )
$stream Guzzle\Stream\StreamInterface
setContextValue() protected method

Set an option on the context and the internal options array

protected void setContextValue ( $wrapper, $name, $value, $overwrite false )
$wrapper string

Stream wrapper name of http

$name string

Context name

$value mixed

Context value

$overwrite bool

Set to true to overwrite an existing value

setUrl() protected method

Set the URL to use with the factory

protected void setUrl ( Guzzle\Http\Message\RequestInterface $request )
$request Guzzle\Http\Message\RequestInterface

Request that owns the URL