Documentation

MultipartBuilder
in package

Table of Contents

Properties

$_body  : mixed
$_boundary  : mixed
$_contents  : mixed

Methods

add()  : $this
Function always use provided $filename. In cases when it's empty, for string content or when name cannot be automatically discovered the $filename will be set to attachment name.
body()  : mixed
boundary()  : null
contents()  : mixed
request()  : RequestInterface
setBody()  : mixed
setBoundary()  : mixed
requestBody()  : StreamInterface|MultipartStream

Properties

Methods

add()

Function always use provided $filename. In cases when it's empty, for string content or when name cannot be automatically discovered the $filename will be set to attachment name.

public add(resource|string|StreamInterface $content[, string $filename = '' ][, array<string|int, mixed> $headers = [] ][, string $name = '' ]) : $this

If attachment name is not provided, it will be randomly generated.

Parameters
$content : resource|string|StreamInterface

StreamInterface/resource/string to send

$filename : string = ''

Optional. Filename of attachment, can't be empty if content is string

$headers : array<string|int, mixed> = []

Optional. Associative array of custom headers

$name : string = ''

Optional. Form field name

Return values
$this

setBody()

public setBody([array<string|int, mixed> $body = [] ]) : mixed
Parameters
$body : array<string|int, mixed> = []

setBoundary()

public setBoundary([mixed $boundary = '' ]) : mixed
Parameters
$boundary : mixed = ''

        
On this page

Search results