Class PhpStreamRequestFactory
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.
- Guzzle\Stream\PhpStreamRequestFactory implements Guzzle\Stream\StreamRequestFactoryInterface
Methods summary
-
public
fromRequest ( Guzzle\Http\Message\RequestInterface $request, array|resource $context = array(), array $params = array() )
Create a stream based on a request object
-
protected
setContextValue ( string $wrapper, string $name, mixed $value, bool $overwrite = false )
Set an option on the context and the internal options array
-
protected
createContext ( array $params )
Create a stream context
-
public
getLastResponseHeaders ( )
Get the last response headers received by the HTTP request
-
protected
addDefaultContextOptions ( Guzzle\Http\Message\RequestInterface $request )
Adds the default context options to the stream context options
-
protected
setUrl ( Guzzle\Http\Message\RequestInterface $request )
Set the URL to use with the factory
-
protected
addSslOptions ( Guzzle\Http\Message\RequestInterface $request )
Add SSL options to the stream context
-
protected
addBodyOptions ( Guzzle\Http\Message\RequestInterface $request )
Add body (content) specific options to the context options
-
protected
addProxyOptions ( Guzzle\Http\Message\RequestInterface $request )
Add proxy parameters to the context if needed
-
protected
createStream ( array $params )
Create the stream for the request with the context options
-
protected
processResponseHeaders ( Guzzle\Stream\StreamInterface $stream )
Process response headers
-
protected
createResource ( callable $callback )
Create a resource and check to ensure it was created successfully
Methods detail
public
Guzzle\Stream\StreamInterface
fromRequest( Guzzle\Http\Message\RequestInterface
$request, array|resource $context = array(), array $params = array() )
Create a stream based on a request object
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
Guzzle\Http\Message\RequestInterface
$request Base the stream on a request- $context
array|resource
$context A stream_context_options resource or array of parameters used to create a stream context.- $params
array
$params Optional array of parameters specific to the factory
Returns
Throws
Implementation of
protected
setContextValue( string $wrapper, string $name, mixed $value, boolean $overwrite = false )
Set an option on the context and the internal options array
Parameters
- $wrapper
string
$wrapper Stream wrapper name of http- $name
string
$name Context name- $value
mixed
$value Context value- $overwrite
boolean
$overwrite Set to true to overwrite an existing value
Create a stream context
Parameters
- $params
array
$params Parameter array
Get the last response headers received by the HTTP request
Returns
array
Adds the default context options to the stream context options
Parameters
- $request
Guzzle\Http\Message\RequestInterface
$request Request
Set the URL to use with the factory
Parameters
- $request
Guzzle\Http\Message\RequestInterface
$request Request that owns the URL
Add SSL options to the stream context
Parameters
- $request
Guzzle\Http\Message\RequestInterface
$request Request
Add body (content) specific options to the context options
Parameters
- $request
Guzzle\Http\Message\RequestInterface
$request
Add proxy parameters to the context if needed
Parameters
- $request
Guzzle\Http\Message\RequestInterface
$request Request
Create the stream for the request with the context options
Parameters
- $params
array
$params Parameters of the stream
Returns
Create a resource and check to ensure it was created successfully
Parameters
- $callback
callable
$callback Closure to invoke that must return a valid resource
Returns
resource
Throws
Magic methods summary
Properties summary
protected
resource
|
$context |
#
Stream context options |
protected
array
|
$contextOptions |
#
Stream context |
protected
|
$url |
#
Stream URL |
protected
array
|
$lastResponseHeaders |
#
Last response headers received by the HTTP request |