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
$_body
protected
mixed
$_body
= []
$_boundary
protected
mixed
$_boundary
= null
$_contents
protected
mixed
$_contents
= []
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
$thisbody()
public
body() : mixed
boundary()
public
boundary() : null
Return values
nullcontents()
public
contents() : mixed
request()
public
request(string $uri[, string $method = 'POST' ]) : RequestInterface
Parameters
- $uri : string
- $method : string = 'POST'
Tags
Return values
RequestInterfacesetBody()
public
setBody([array<string|int, mixed> $body = [] ]) : mixed
Parameters
- $body : array<string|int, mixed> = []
setBoundary()
public
setBoundary([mixed $boundary = '' ]) : mixed
Parameters
- $boundary : mixed = ''
requestBody()
protected
requestBody() : StreamInterface|MultipartStream