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 | $timestamp | The attachment's timestamp. |
|
| string | $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 41
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 57
protected int
currentTime()
Get the current system time as a UNIX timestamp.
in
InteractsWithTime at line 65
protected string
runTimeForHumans(float $startTime, float|null $endTime = null)
Given a start time, format the total run time for human readability.
at line 109
SlackAttachment
title(string $title, string|null $url = null)
Set the title of the attachment.
at line 120
SlackAttachment
pretext(string $pretext)
Set the pretext of the attachment.
at line 130
SlackAttachment
content(string $content)
Set the content (text) of the attachment.
at line 140
SlackAttachment
fallback(string $fallback)
A plain-text summary of the attachment.
at line 150
SlackAttachment
color(string $color)
Set the color of the attachment.
at line 160
SlackAttachment
field(Closure|string $title, string $content = '')
Add a field to the attachment.
at line 180
SlackAttachment
fields(array $fields)
Set the fields of the attachment.
at line 190
SlackAttachment
markdown(array $fields)
Set the fields containing markdown.
at line 200
SlackAttachment
image(string $url)
Set the image URL.
at line 210
SlackAttachment
thumb(string $url)
Set the URL to the attachment thumbnail.
at line 220
SlackAttachment
action(string $title, string $url, string $style = '')
Add an action (button) under the attachment.
at line 235
SlackAttachment
author(string $name, string|null $link = null, string|null $icon = null)
Set the author of the attachment.
at line 247
SlackAttachment
footer(string $footer)
Set the footer content.
at line 257
SlackAttachment
footerIcon(string $icon)
Set the footer icon.
at line 267
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 277
SlackAttachment
callbackId(string $callbackId)
Set the callback ID.