UnfurledMediaItem
in package
implements
JsonSerializable
Represents an unfurled media item, which is the base for V2 components.
It allows you to specify an arbitrary url or attachment reference.
Tags
Table of Contents
Interfaces
- JsonSerializable
Properties
- $url : string
- Source URL of media item (only supports http(s) and attachments).
Methods
- fromAttachment() : self
- Creates a new unfurled media item from an attachment.
- getUrl() : string|null
- Returns the URL of the media item.
- jsonSerialize() : array<string|int, mixed>
- new() : self
- Creates a new unfurled media item.
- setUrl() : $this
- Sets the URL of the media item.
Properties
$url
Source URL of media item (only supports http(s) and attachments).
protected
string
$url
Methods
fromAttachment()
Creates a new unfurled media item from an attachment.
public
static fromAttachment(Attachment|string $filename) : self
Parameters
- $filename : Attachment|string
-
Name of the attachment file, or null.
Return values
selfgetUrl()
Returns the URL of the media item.
public
getUrl() : string|null
Return values
string|nulljsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>new()
Creates a new unfurled media item.
public
static new(string $url) : self
Parameters
- $url : string
-
URL or attachment reference of the media item.
Return values
selfsetUrl()
Sets the URL of the media item.
public
setUrl(string $url) : $this
Parameters
- $url : string
-
URL or attachment reference of the media item.