Open Journal Systems  3.3.0
GuzzleHttp\Psr7 Namespace Reference

Data Structures

class  AppendStream
 
class  BufferStream
 
class  CachingStream
 
class  DroppingStream
 
class  FnStream
 
class  InflateStream
 
class  LazyOpenStream
 
class  LimitStream
 
class  MultipartStream
 
class  NoSeekStream
 
class  PumpStream
 
class  Request
 
class  Response
 
class  Rfc7230
 
class  ServerRequest
 
class  Stream
 
class  StreamWrapper
 
class  UploadedFile
 
class  Uri
 
class  UriNormalizer
 
class  UriResolver
 

Functions

 _caseless_remove ($keys, array $data)
 
 _parse_message ($message)
 
 _parse_request_uri ($path, array $headers)
 
 build_query (array $params, $encoding=PHP_QUERY_RFC3986)
 
 copy_to_stream (StreamInterface $source, StreamInterface $dest, $maxLen=-1)
 
 copy_to_string (StreamInterface $stream, $maxLen=-1)
 
 get_message_body_summary (MessageInterface $message, $truncateAt=120)
 
 getBody ()
 
 getHeader ($header)
 
 getHeaderLine ($header)
 
 getHeaders ()
 
 getProtocolVersion ()
 
 hash (StreamInterface $stream, $algo, $rawOutput=false)
 
 hasHeader ($header)
 
 mimetype_from_extension ($extension)
 
 mimetype_from_filename ($filename)
 
 modify_request (RequestInterface $request, array $changes)
 
 normalize_header ($header)
 
 parse_header ($header)
 
 parse_query ($str, $urlEncoding=true)
 
 parse_request ($message)
 
 parse_response ($message)
 
 readline (StreamInterface $stream, $maxLength=null)
 
 rewind_body (MessageInterface $message)
 
 str (MessageInterface $message)
 
 stream_for ($resource='', array $options=[])
 
 try_fopen ($filename, $mode)
 
 uri_for ($uri)
 
 withAddedHeader ($header, $value)
 
 withBody (StreamInterface $body)
 
 withHeader ($header, $value)
 
 withoutHeader ($header)
 
 withProtocolVersion ($version)
 

Variables

trait MessageTrait
 

Function Documentation

◆ _caseless_remove()

GuzzleHttp\Psr7\_caseless_remove (   $keys,
array  $data 
)

Definition at line 884 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\modify_request().

◆ _parse_message()

GuzzleHttp\Psr7\_parse_message (   $message)

Parses an HTTP message into an associative array.

The array contains the "start-line" key containing the start line of the message, "headers" key containing an associative array of header array values, and a "body" key containing the body of the message.

Parameters
string$messageHTTP request or response to parse.
Returns
array

Definition at line 762 of file guzzlehttp/psr7/src/functions.php.

References GuzzleHttp\Psr7\Rfc7230\HEADER_FOLD_REGEX, and GuzzleHttp\Psr7\Rfc7230\HEADER_REGEX.

Referenced by GuzzleHttp\Psr7\parse_request(), and GuzzleHttp\Psr7\parse_response().

◆ _parse_request_uri()

GuzzleHttp\Psr7\_parse_request_uri (   $path,
array  $headers 
)

Constructs a URI for an HTTP request message.

Parameters
string$pathPath from the start-line
array$headersArray of headers (each value an array).
Returns
string

Definition at line 826 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\parse_request().

◆ build_query()

GuzzleHttp\Psr7\build_query ( array  $params,
  $encoding = PHP_QUERY_RFC3986 
)

Build a query string from an array of key value pairs.

This function can use the return value of parse_query() to build a query string. This function does not modify the provided keys when an array is encountered (like http_build_query would).

Parameters
array$paramsQuery string parameters.
int | false$encodingSet to false to not encode, PHP_QUERY_RFC3986 to encode using RFC3986, or PHP_QUERY_RFC1738 to encode using RFC1738.
Returns
string

Definition at line 578 of file guzzlehttp/psr7/src/functions.php.

◆ copy_to_stream()

GuzzleHttp\Psr7\copy_to_stream ( StreamInterface  $source,
StreamInterface  $dest,
  $maxLen = -1 
)

Copy the contents of a stream into another stream until the given number of bytes have been read.

Parameters
StreamInterface$sourceStream to read from
StreamInterface$destStream to write to
int$maxLenMaximum number of bytes to read. Pass -1 to read the entire stream.
Exceptions

Definition at line 373 of file guzzlehttp/psr7/src/functions.php.

References Psr\Http\Message\StreamInterface\write().

Referenced by GuzzleHttp\Psr7\UploadedFile\moveTo().

◆ copy_to_string()

GuzzleHttp\Psr7\copy_to_string ( StreamInterface  $stream,
  $maxLen = -1 
)

Copy the contents of a stream into a string until the given number of bytes have been read.

Parameters
StreamInterface$streamStream to read
int$maxLenMaximum number of bytes to read. Pass -1 to read the entire stream.
Returns
string
Exceptions

Definition at line 332 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\PumpStream\__toString(), and GuzzleHttp\Psr7\AppendStream\getContents().

◆ get_message_body_summary()

GuzzleHttp\Psr7\get_message_body_summary ( MessageInterface  $message,
  $truncateAt = 120 
)

Get a short summary of the message body

Will return null if the response is not printable.

Parameters
MessageInterface$messageThe message to get the body summary
int$truncateAtThe maximum allowed size of the summary
Returns
null|string

Definition at line 853 of file guzzlehttp/psr7/src/functions.php.

References Psr\Http\Message\MessageInterface\getBody().

◆ getBody()

GuzzleHttp\Psr7\getBody ( )

Definition at line 129 of file MessageTrait.php.

References GuzzleHttp\Psr7\stream_for().

◆ getHeader()

GuzzleHttp\Psr7\getHeader (   $header)

Definition at line 61 of file MessageTrait.php.

Referenced by GuzzleHttp\Psr7\getHeaderLine().

◆ getHeaderLine()

GuzzleHttp\Psr7\getHeaderLine (   $header)

Definition at line 74 of file MessageTrait.php.

References GuzzleHttp\Psr7\getHeader().

◆ getHeaders()

GuzzleHttp\Psr7\getHeaders ( )

Definition at line 51 of file MessageTrait.php.

◆ getProtocolVersion()

GuzzleHttp\Psr7\getProtocolVersion ( )

Definition at line 35 of file MessageTrait.php.

◆ hash()

GuzzleHttp\Psr7\hash ( StreamInterface  $stream,
  $algo,
  $rawOutput = false 
)

Calculate a hash of a Stream

Parameters
StreamInterface$streamStream to calculate the hash for
string$algoHash algorithm (e.g. md5, crc32, etc)
bool$rawOutputWhether or not to use raw output
Returns
string Returns the hash of the stream
Exceptions

Definition at line 410 of file guzzlehttp/psr7/src/functions.php.

◆ hasHeader()

GuzzleHttp\Psr7\hasHeader (   $header)

Definition at line 56 of file MessageTrait.php.

◆ mimetype_from_extension()

GuzzleHttp\Psr7\mimetype_from_extension (   $extension)

Maps a file extensions to a mimetype.

Parameters
$extensionstring The file extension.
Returns
string|null http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types

Definition at line 637 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\mimetype_from_filename().

◆ mimetype_from_filename()

GuzzleHttp\Psr7\mimetype_from_filename (   $filename)

Determines the mimetype of a file by looking at its extension.

Parameters
$filename
Returns
null|string

Definition at line 624 of file guzzlehttp/psr7/src/functions.php.

References GuzzleHttp\Psr7\mimetype_from_extension().

Referenced by GuzzleHttp\PrepareBodyMiddleware\__invoke().

◆ modify_request()

GuzzleHttp\Psr7\modify_request ( RequestInterface  $request,
array  $changes 
)

Clone and modify a request with the given changes.

The changes can be one of:

  • method: (string) Changes the HTTP method.
  • set_headers: (array) Sets the given headers.
  • remove_headers: (array) Remove the given headers.
  • body: (mixed) Sets the given body.
  • uri: (UriInterface) Set the URI.
  • query: (string) Set the query string value of the URI.
  • version: (string) Set the protocol version.
Parameters
RequestInterface$requestRequest to clone and modify.
array$changesChanges to apply.
Returns
RequestInterface

Definition at line 201 of file guzzlehttp/psr7/src/functions.php.

References GuzzleHttp\Psr7\_caseless_remove(), Psr\Http\Message\MessageInterface\getBody(), Psr\Http\Message\MessageInterface\getHeaders(), Psr\Http\Message\RequestInterface\getMethod(), Psr\Http\Message\MessageInterface\getProtocolVersion(), and Psr\Http\Message\RequestInterface\getUri().

Referenced by GuzzleHttp\PrepareBodyMiddleware\__invoke().

◆ normalize_header()

GuzzleHttp\Psr7\normalize_header (   $header)

Converts an array of header values that may contain comma separated headers into an array of headers with no comma separated values.

Parameters
string | array$headerHeader to normalize.
Returns
array Returns the normalized header field values.

Definition at line 162 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\parse_header().

◆ parse_header()

GuzzleHttp\Psr7\parse_header (   $header)

Parse an array of header values containing ";" separated data into an array of associative arrays representing the header key value pair data of the header. When a parameter does not contain a value, but just contains a key, this function will inject a key with a '' string value.

Parameters
string | array$headerHeader to parse into components.
Returns
array Returns the parsed header values.

Definition at line 129 of file guzzlehttp/psr7/src/functions.php.

References GuzzleHttp\Psr7\normalize_header().

◆ parse_query()

GuzzleHttp\Psr7\parse_query (   $str,
  $urlEncoding = true 
)

Parse a query string into an associative array.

If multiple values are found for the same key, the value of that key value pair will become an array. This function does not parse nested PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will be parsed into ['foo[a]' => '1', 'foo[b]' => '2']).

Parameters
string$strQuery string to parse
int | bool$urlEncodingHow the query string is encoded
Returns
array

Definition at line 528 of file guzzlehttp/psr7/src/functions.php.

◆ parse_request()

GuzzleHttp\Psr7\parse_request (   $message)

Parses a request message string into a request object.

Parameters
string$messageRequest message string.
Returns
Request

Definition at line 467 of file guzzlehttp/psr7/src/functions.php.

References GuzzleHttp\Psr7\_parse_message(), and GuzzleHttp\Psr7\_parse_request_uri().

◆ parse_response()

GuzzleHttp\Psr7\parse_response (   $message)

Parses a response message string into a response object.

Parameters
string$messageResponse message string.
Returns
Response

Definition at line 495 of file guzzlehttp/psr7/src/functions.php.

References GuzzleHttp\Psr7\_parse_message().

◆ readline()

GuzzleHttp\Psr7\readline ( StreamInterface  $stream,
  $maxLength = null 
)

Read a line from the stream up to the maximum allowed buffer length

Parameters
StreamInterface$streamStream to read from
int$maxLengthMaximum buffer length
Returns
string

Definition at line 440 of file guzzlehttp/psr7/src/functions.php.

◆ rewind_body()

GuzzleHttp\Psr7\rewind_body ( MessageInterface  $message)

Attempts to rewind a message body and throws an exception on failure.

The body of the message will only be rewound if a call to tell() returns a value other than 0.

Parameters
MessageInterface$messageMessage to rewind
Exceptions

Definition at line 278 of file guzzlehttp/psr7/src/functions.php.

References Psr\Http\Message\MessageInterface\getBody().

◆ str()

GuzzleHttp\Psr7\str ( MessageInterface  $message)

Returns the string representation of an HTTP message.

Parameters
MessageInterface$messageMessage to convert to a string.
Returns
string

Definition at line 18 of file guzzlehttp/psr7/src/functions.php.

References Psr\Http\Message\MessageInterface\getBody(), Psr\Http\Message\MessageInterface\getHeaders(), Psr\Http\Message\MessageInterface\getProtocolVersion(), and Psr\Http\Message\MessageInterface\hasHeader().

◆ stream_for()

GuzzleHttp\Psr7\stream_for (   $resource = '',
array  $options = [] 
)

Create a new stream based on the input type.

Options is an associative array that can contain the following keys:

  • metadata: Array of custom metadata.
  • size: Size of the stream.
Parameters
resource | string | null | int | float | bool | StreamInterface | callable | \Iterator$resourceEntity body data
array$optionsAdditional options
Returns
StreamInterface
Exceptions

Definition at line 78 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\Request\__construct(), GuzzleHttp\Psr7\Response\__construct(), XMLParser\_getStream(), GuzzleHttp\Psr7\LazyOpenStream\createStream(), GuzzleHttp\Psr7\MultipartStream\createStream(), and GuzzleHttp\Psr7\getBody().

◆ try_fopen()

GuzzleHttp\Psr7\try_fopen (   $filename,
  $mode 
)

Safely opens a PHP stream resource using a filename.

When fopen fails, PHP normally raises a warning. This function adds an error handler that checks for errors and throws an exception instead.

Parameters
string$filenameFile to open
string$modeMode used to open the file
Returns
resource
Exceptions

Definition at line 299 of file guzzlehttp/psr7/src/functions.php.

Referenced by GuzzleHttp\Psr7\LazyOpenStream\createStream().

◆ uri_for()

GuzzleHttp\Psr7\uri_for (   $uri)

Returns a UriInterface for the given value.

This function accepts a string or {

See also
Psr\Http\Message\UriInterface} and returns a UriInterface for the given value. If the value is already a UriInterface, it is returned as-is.
Parameters
string | UriInterface$uri
Returns
UriInterface
Exceptions

Definition at line 54 of file guzzlehttp/psr7/src/functions.php.

◆ withAddedHeader()

GuzzleHttp\Psr7\withAddedHeader (   $header,
  $value 
)

Definition at line 95 of file MessageTrait.php.

◆ withBody()

GuzzleHttp\Psr7\withBody ( StreamInterface  $body)

Definition at line 138 of file MessageTrait.php.

◆ withHeader()

GuzzleHttp\Psr7\withHeader (   $header,
  $value 
)

Definition at line 79 of file MessageTrait.php.

◆ withoutHeader()

GuzzleHttp\Psr7\withoutHeader (   $header)

Definition at line 113 of file MessageTrait.php.

◆ withProtocolVersion()

GuzzleHttp\Psr7\withProtocolVersion (   $version)

Definition at line 40 of file MessageTrait.php.

Variable Documentation

◆ MessageTrait

trait GuzzleHttp::Psr7\MessageTrait
Initial value:
{
private $headers = []

Trait implementing functionality common to requests and responses.

Definition at line 10 of file MessageTrait.php.