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.

$authorLink

The attachment author's link.

string|null $authorIcon

The attachment author's icon.

$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

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

title(string $title, string|null $url = null)

Set the title of the attachment.

pretext(string $pretext)

Set the pretext of the attachment.

content(string $content)

Set the content (text) of the attachment.

fallback(string $fallback)

A plain-text summary of the attachment.

color(string $color)

Set the color of the attachment.

field(Closure|string $title, string $content = '')

Add a field to the attachment.

fields(array $fields)

Set the fields of the attachment.

markdown(array $fields)

Set the fields containing markdown.

image(string $url)

Set the image URL.

thumb(string $url)

Set the URL to the attachment thumbnail.

action(string $title, string $url, string $style = '')

Add an action (button) under the attachment.

author(string $name, string|null $link = null, string|null $icon = null)

Set the author of the attachment.

footer(string $footer)

Set the footer content.

footerIcon(string $icon)

Set the footer icon.

timestamp(DateInterval|DateTimeInterface|int $timestamp)

Set the timestamp a DateTimeInterface, DateInterval, or the number of seconds that should be added to the current time.

callbackId(string $callbackId)

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.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

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.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 57
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

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.

Parameters

float $startTime
float|null $endTime

Return Value

string

at line 109
SlackAttachment title(string $title, string|null $url = null)

Set the title of the attachment.

Parameters

string $title
string|null $url

Return Value

SlackAttachment

at line 120
SlackAttachment pretext(string $pretext)

Set the pretext of the attachment.

Parameters

string $pretext

Return Value

SlackAttachment

at line 130
SlackAttachment content(string $content)

Set the content (text) of the attachment.

Parameters

string $content

Return Value

SlackAttachment

at line 140
SlackAttachment fallback(string $fallback)

A plain-text summary of the attachment.

Parameters

string $fallback

Return Value

SlackAttachment

at line 150
SlackAttachment color(string $color)

Set the color of the attachment.

Parameters

string $color

Return Value

SlackAttachment

at line 160
SlackAttachment field(Closure|string $title, string $content = '')

Add a field to the attachment.

Parameters

Closure|string $title
string $content

Return Value

SlackAttachment

at line 180
SlackAttachment fields(array $fields)

Set the fields of the attachment.

Parameters

array $fields

Return Value

SlackAttachment

at line 190
SlackAttachment markdown(array $fields)

Set the fields containing markdown.

Parameters

array $fields

Return Value

SlackAttachment

at line 200
SlackAttachment image(string $url)

Set the image URL.

Parameters

string $url

Return Value

SlackAttachment

at line 210
SlackAttachment thumb(string $url)

Set the URL to the attachment thumbnail.

Parameters

string $url

Return Value

SlackAttachment

at line 220
SlackAttachment action(string $title, string $url, string $style = '')

Add an action (button) under the attachment.

Parameters

string $title
string $url
string $style

Return Value

SlackAttachment

at line 235
SlackAttachment author(string $name, string|null $link = null, string|null $icon = null)

Set the author of the attachment.

Parameters

string $name
string|null $link
string|null $icon

Return Value

SlackAttachment

Set the footer content.

Parameters

string $footer

Return Value

SlackAttachment

at line 257
SlackAttachment footerIcon(string $icon)

Set the footer icon.

Parameters

string $icon

Return Value

SlackAttachment

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.

Parameters

DateInterval|DateTimeInterface|int $timestamp

Return Value

SlackAttachment

at line 277
SlackAttachment callbackId(string $callbackId)

Set the callback ID.

Parameters

string $callbackId

Return Value

SlackAttachment