Copied!

Stream that when read returns bytes for a streaming multipart or multipart/form-data stream.

CloneableFinalInstantiable
Methods
public __call(string $method, array $args)
 

Allow decorators to implement custom methods

  • return mixed
public __construct(array $elements = [], ?string $boundary = NULL)
 
  • param array $elements Array of associative arrays, each containing a required "name" key mapping to the form field, name, a required "contents" key mapping to any non-array value accepted by Utils::streamFor(), or an array for nested expansion. Optional keys include "headers" (associative array of custom headers) and "filename" (string to send as the filename in the part). When "contents" is an array, it is recursively expanded into multiple fields using bracket notation (e.g., name[0][key]). Empty arrays produce no fields. The "filename" and "headers" options cannot be used with array contents.
  • param string|null $boundary You can optionally provide a specific boundary
  • throws \InvalidArgumentException
public __get(string $name)
 

Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).

  • return \StreamInterface
public __toString() : string
public close() : void
public detach()
public eof() : bool
public getBoundary() : string
public getContents() : string
public getMetadata( $key = NULL)
 
  • return mixed
public getSize() : ?int
public isReadable() : bool
public isSeekable() : bool
public isWritable() : bool
public read( $length) : string
public rewind() : void
public seek( $offset, $whence = 0GuzzleHttp\Psr7\SEEK_SET) : void
public tell() : int
public write( $string) : int
Methods
protected createStream(array $elements = []) : Psr\Http\Message\StreamInterface
 

Create the aggregate stream that will be used to upload the POST data

Constants
private GuzzleHttp\Psr7\MultipartStream::BOUNDARY_CHARS = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'()+_,-./:=? '
Properties
private $boundary = NULL
 
  • var string
private $stream = NULL
 
  • var \StreamInterface
Methods
private addElement(GuzzleHttp\Psr7\AppendStream $stream, array $element) : void
private addNestedElements(GuzzleHttp\Psr7\AppendStream $stream, array $contents, string $root) : void
 

Recursively expand array contents into multiple form fields.

  • param array<array-key, mixed> $contents
private createElement(string $name, Psr\Http\Message\StreamInterface $stream, ?string $filename, array $headers) : array
 
  • param array<array-key, mixed> $headers
  • return array{0: \StreamInterface, 1: array<array-key, string>}
private static deprecateInvalidPartHeaderName(string $name) : void
private static deprecateInvalidPartHeaderValue(string $value) : void
private static getHeader(array $headers, string $key) : ?string
 
  • param array<array-key, string> $headers
private getHeaders(array $headers) : string
 

Get the headers needed before transferring the content of a POST file

  • param array<array-key, string> $headers
private static isValidBoundary(string $boundary) : bool
private static normalizePartHeaders(array $headers) : array
 
  • param array<array-key, mixed> $headers
  • return array<array-key, string>
Methods
private static deprecateInvalidPartHeaderName(string $name) : void
private static deprecateInvalidPartHeaderValue(string $value) : void
private static getHeader(array $headers, string $key) : ?string
 
  • param array<array-key, string> $headers
private static isValidBoundary(string $boundary) : bool
private static normalizePartHeaders(array $headers) : array
 
  • param array<array-key, mixed> $headers
  • return array<array-key, string>
© 2026 Bruce Wells
Search Namespaces \ Classes
Configuration