SlackAttachment
class SlackAttachment
Traits
Properties
| string|null | $title | The attachment's title. |
|
| string|null | $url | The attachment's URL. |
|
| string|null | $pretext | The attachment's pretext. |
|
| string|null | $content | The attachment's text content. |
|
| string|null | $fallback | A plain-text summary of the attachment. |
|
| string|null | $color | The attachment's color. |
|
| array | $fields | The attachment's fields. |
|
| array | $markdown | The fields containing markdown. |
|
| string|null | $imageUrl | The attachment's image url. |
|
| string|null | $thumbUrl | The attachment's thumb url. |
|
| array | $actions | The attachment's actions. |
|
| string|null | $authorName | The attachment author's name. |
|
| string|null | $authorLink | The attachment author's link. |
|
| string|null | $authorIcon | The attachment author's icon. |
|
| string|null | $footer | The attachment's footer. |
|
| string|null | $footerIcon | The attachment's footer icon. |
|
| int|null | $timestamp | The attachment's timestamp. |
|
| string|null | $callbackId | The attachment's callback ID. |
Methods
Get the number of seconds until the given DateTime.
Get the "available at" UNIX timestamp.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Set the title of the attachment.
Set the pretext of the attachment.
Set the content (text) of the attachment.
A plain-text summary of the attachment.
Set the color of the attachment.
Set the fields of the attachment.
Set the fields containing markdown.
Set the image URL.
Set the URL to the attachment thumbnail.
Add an action (button) under the attachment.
Set the author of the attachment.
Set the footer content.
Set the footer icon.
Set the timestamp a DateTimeInterface, DateInterval, or the number of seconds that should be added to the current time.
Set the callback ID.
Details
in
InteractsWithTime at line 17
protected int
secondsUntil(DateInterval|DateTimeInterface|int $delay)
Get the number of seconds until the given DateTime.
in
InteractsWithTime at line 29
protected int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)
Get the "available at" UNIX timestamp.
in
InteractsWithTime at line 47
protected DateTimeInterface|int
parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)
If the given value is an interval, convert it to a DateTime instance.
in
InteractsWithTime at line 63
protected int
currentTime()
Get the current system time as a UNIX timestamp.
in
InteractsWithTime at line 71
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
at line 111
SlackAttachment
title(string $title, string|null $url = null)
Set the title of the attachment.
at line 124
SlackAttachment
pretext(string $pretext)
Set the pretext of the attachment.
at line 136
SlackAttachment
content(string $content)
Set the content (text) of the attachment.
at line 148
SlackAttachment
fallback(string $fallback)
A plain-text summary of the attachment.
at line 160
SlackAttachment
color(string $color)
Set the color of the attachment.
at line 172
SlackAttachment
field(Closure|string $title, string $content = '')
Add a field to the attachment.
at line 195
SlackAttachment
fields(array $fields)
Set the fields of the attachment.
at line 207
SlackAttachment
markdown(array $fields)
Set the fields containing markdown.
at line 219
SlackAttachment
image(string $url)
Set the image URL.
at line 231
SlackAttachment
thumb(string $url)
Set the URL to the attachment thumbnail.
at line 243
SlackAttachment
action(string $title, string $url, string $style = '')
Add an action (button) under the attachment.
at line 260
SlackAttachment
author(string $name, string|null $link = null, string|null $icon = null)
Set the author of the attachment.
at line 274
SlackAttachment
footer(string $footer)
Set the footer content.
at line 286
SlackAttachment
footerIcon(string $icon)
Set the footer icon.
at line 298
SlackAttachment
timestamp(DateInterval|DateTimeInterface|int $timestamp)
Set the timestamp a DateTimeInterface, DateInterval, or the number of seconds that should be added to the current time.
at line 310
SlackAttachment
callbackId(string $callbackId)
Set the callback ID.