Multipart
in package
implements
Stringable
Builds a multipart request.
Tags
Table of Contents
Interfaces
- Stringable
Constants
- BOUNDARY = '----DiscordPHPSendFileBoundary'
- The boundary separating multipart sections.
Properties
Methods
- __construct() : mixed
- Multipart constructor.
- __toString() : string
- Converts the multipart request to string.
- add() : $this
- Adds a field to the request.
- getContentType() : string
- Gets the content type for the multipart request.
- getHeaders() : array<string|int, mixed>
- Gets the headers for the given request.
Constants
BOUNDARY
The boundary separating multipart sections.
private
mixed
BOUNDARY
= '----DiscordPHPSendFileBoundary'
Properties
$boundary
Field boundary.
protected
string
$boundary
$fields
Fields part of the request.
protected
array<string|int, mixed>
$fields
= []
Methods
__construct()
Multipart constructor.
public
__construct([array<string|int, mixed> $fields = [] ][, string $boundary = self::BOUNDARY ]) : mixed
Parameters
- $fields : array<string|int, mixed> = []
- $boundary : string = self::BOUNDARY
-
Defaults to DiscordPHPSendFileBoundary
__toString()
Converts the multipart request to string.
public
__toString() : string
Return values
stringadd()
Adds a field to the request.
public
add(array<string|int, mixed> ...$fields) : $this
$field = [
'name' => 'Field name',
'content' => 'Field content',
// Optional
'filename' => 'File name',
'headers' => [
// ...
],
];
Parameters
- $fields : array<string|int, mixed>
Return values
$thisgetContentType()
Gets the content type for the multipart request.
public
getContentType() : string
Return values
stringgetHeaders()
Gets the headers for the given request.
public
getHeaders() : array<string|int, mixed>