Stream
extends AbstractHandler
in package
HTTP client stream handler class
Tags
Table of Contents
Properties
- $context : mixed
- Stream context
- $contextOptions : array<string|int, mixed>
- Stream context options
- $contextParams : array<string|int, mixed>
- Stream context parameters
- $httpResponseHeaders : array<string|int, mixed>|null
- HTTP response headers
- $httpVersion : string
- HTTP version
- $mode : string
- Stream mode
- $resource : mixed
- Client resource object
- $uri : string|null
- URI string
Methods
- __construct() : mixed
- Constructor
- addContextOption() : Stream
- Add a context options
- addContextParam() : Stream
- Add a context parameter
- allowSelfSigned() : Stream
- Set Stream context option to set to allow self-signed certs (verify host)
- create() : Stream
- Factory method to create a Curl client
- createContext() : Stream
- Create stream context
- disconnect() : void
- Close the handler connection
- getContext() : mixed
- Get the context resource
- getContextOption() : mixed
- Get a context option
- getContextOptions() : array<string|int, mixed>
- Get the context options
- getContextParam() : mixed
- Get a context parameter
- getContextParams() : array<string|int, mixed>
- Get the context parameters
- getHttpVersion() : string
- Get the URI string
- getMode() : string
- Get the mode
- getResource() : mixed
- Get the resource
- getUri() : string|null
- Get the URI string
- getUriObject() : Uri
- Get the URI as an object
- hasContextOption() : bool
- Determine if a context option has been set
- hasContextParam() : bool
- Determine if a context parameter has been set
- hasResource() : bool
- Determine whether or not resource is available
- hasUri() : bool
- Determine whether or not there is a URI string
- isAllowSelfSigned() : bool
- Check if Stream is set to allow self-signed certs
- isVerifyPeer() : bool
- Check if Stream is set to verify peer
- parseResponse() : Response
- Parse the response
- prepare() : Stream
- Method to prepare the handler
- reset() : Stream
- Method to reset the handler
- resource() : mixed
- Get the resource (alias method)
- send() : Response
- Method to send the request
- setContextOptions() : Stream
- Set the context options
- setContextParams() : Stream
- Set the context parameters
- setMethod() : Stream
- Set the method
- setMode() : Stream
- Set the mode
- setVerifyPeer() : Stream
- Set Stream context option to set verify peer (verifies the domain's SSL cert)
- stream() : mixed
- Return stream resource (alias to $this->getResource())
Properties
$context
Stream context
protected
mixed
$context
= null
$contextOptions
Stream context options
protected
array<string|int, mixed>
$contextOptions
= []
$contextParams
Stream context parameters
protected
array<string|int, mixed>
$contextParams
= []
$httpResponseHeaders
HTTP response headers
protected
array<string|int, mixed>|null
$httpResponseHeaders
= null
$httpVersion
HTTP version
protected
string
$httpVersion
= '1.1'
$mode
Stream mode
protected
string
$mode
= 'r'
$resource
Client resource object
protected
mixed
$resource
= null
$uri
URI string
protected
string|null
$uri
= null
Methods
__construct()
Constructor
public
__construct([string $mode = 'r' ][, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $params = [] ]) : mixed
Instantiate the stream handler object
Parameters
- $mode : string = 'r'
- $options : array<string|int, mixed> = []
- $params : array<string|int, mixed> = []
addContextOption()
Add a context options
public
addContextOption(string $name, mixed $option) : Stream
Parameters
- $name : string
- $option : mixed
Return values
StreamaddContextParam()
Add a context parameter
public
addContextParam(string $name, mixed $param) : Stream
Parameters
- $name : string
- $param : mixed
Return values
StreamallowSelfSigned()
Set Stream context option to set to allow self-signed certs (verify host)
public
allowSelfSigned([bool $allow = true ]) : Stream
Parameters
- $allow : bool = true
Return values
Streamcreate()
Factory method to create a Curl client
public
static create([string $method = 'GET' ][, string $mode = 'r' ][, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $params = [] ]) : Stream
Parameters
- $method : string = 'GET'
- $mode : string = 'r'
- $options : array<string|int, mixed> = []
- $params : array<string|int, mixed> = []
Return values
StreamcreateContext()
Create stream context
public
createContext() : Stream
Return values
Streamdisconnect()
Close the handler connection
public
disconnect() : void
getContext()
Get the context resource
public
getContext() : mixed
getContextOption()
Get a context option
public
getContextOption(string $name) : mixed
Parameters
- $name : string
getContextOptions()
Get the context options
public
getContextOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getContextParam()
Get a context parameter
public
getContextParam(string $name) : mixed
Parameters
- $name : string
getContextParams()
Get the context parameters
public
getContextParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getHttpVersion()
Get the URI string
public
getHttpVersion() : string
Return values
stringgetMode()
Get the mode
public
getMode() : string
Return values
stringgetResource()
Get the resource
public
getResource() : mixed
getUri()
Get the URI string
public
getUri() : string|null
Return values
string|nullgetUriObject()
Get the URI as an object
public
getUriObject() : Uri
Return values
UrihasContextOption()
Determine if a context option has been set
public
hasContextOption(string $name) : bool
Parameters
- $name : string
Return values
boolhasContextParam()
Determine if a context parameter has been set
public
hasContextParam(string $name) : bool
Parameters
- $name : string
Return values
boolhasResource()
Determine whether or not resource is available
public
hasResource() : bool
Return values
boolhasUri()
Determine whether or not there is a URI string
public
hasUri() : bool
Return values
boolisAllowSelfSigned()
Check if Stream is set to allow self-signed certs
public
isAllowSelfSigned() : bool
Return values
boolisVerifyPeer()
Check if Stream is set to verify peer
public
isVerifyPeer() : bool
Return values
boolparseResponse()
Parse the response
public
parseResponse() : Response
Return values
Responseprepare()
Method to prepare the handler
public
prepare(Request|AbstractRequest $request[, Auth|null $auth = null ][, bool $clear = true ]) : Stream
Parameters
- $request : Request|AbstractRequest
- $auth : Auth|null = null
- $clear : bool = true
Tags
Return values
Streamreset()
Method to reset the handler
public
reset() : Stream
Return values
Streamresource()
Get the resource (alias method)
public
resource() : mixed
send()
Method to send the request
public
send() : Response
Tags
Return values
ResponsesetContextOptions()
Set the context options
public
setContextOptions(array<string|int, mixed> $options) : Stream
Parameters
- $options : array<string|int, mixed>
Return values
StreamsetContextParams()
Set the context parameters
public
setContextParams(array<string|int, mixed> $params) : Stream
Parameters
- $params : array<string|int, mixed>
Return values
StreamsetMethod()
Set the method
public
setMethod(string $method) : Stream
Parameters
- $method : string
Return values
StreamsetMode()
Set the mode
public
setMode(string $mode) : Stream
Parameters
- $mode : string
Return values
StreamsetVerifyPeer()
Set Stream context option to set verify peer (verifies the domain's SSL cert)
public
setVerifyPeer([bool $verify = true ]) : Stream
Parameters
- $verify : bool = true
Return values
Streamstream()
Return stream resource (alias to $this->getResource())
public
stream() : mixed