class SlackAttachment (View source)

Traits

Properties

string $title The attachment's title.
string $url The attachment's URL.
string $pretext The attachment's pretext.
string $content The attachment's text content.
string $fallback A plain-text summary of the attachment.
string $color The attachment's color.
array $fields The attachment's fields.
array $markdown The fields containing markdown.
string $imageUrl The attachment's image url.
string $thumbUrl The attachment's thumb url.
string $authorName The attachment author's name.
$authorLink The attachment author's link.
string $authorIcon The attachment author's icon.
$footer The attachment's footer.
string $footerIcon The attachment's footer icon.
int $timestamp The attachment's timestamp.

Methods

int
secondsUntil(DateTimeInterface|DateInterval|int $delay)

Get the number of seconds until the given DateTime.

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

Get the "available at" UNIX timestamp.

parseDateInterval(DateTimeInterface|DateInterval|int $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.

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

Set the title of the attachment.

$this
pretext(string $pretext)

Set the pretext of the attachment.

$this
content(string $content)

Set the content (text) of the attachment.

$this
fallback(string $fallback)

A plain-text summary of the attachment.

$this
color(string $color)

Set the color of the attachment.

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

Add a field to the attachment.

$this
fields(array $fields)

Set the fields of the attachment.

$this
markdown(array $fields)

Set the fields containing markdown.

$this
image(string $url)

Set the image URL.

$this
thumb(string $url)

Set the URL to the attachment thumbnail.

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

Set the author of the attachment.

$this
footer(string $footer)

Set the footer content.

$this
footerIcon(string $icon)

Set the footer icon.

$this
timestamp(DateTimeInterface|DateInterval|int $timestamp)

Set the timestamp.

Details

protected int secondsUntil(DateTimeInterface|DateInterval|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

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

Get the "available at" UNIX timestamp.

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

int

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

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

Parameters

DateTimeInterface|DateInterval|int $delay

Return Value

DateTimeInterface|int

protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

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

Set the title of the attachment.

Parameters

string $title
string|null $url

Return Value

$this

$this pretext(string $pretext)

Set the pretext of the attachment.

Parameters

string $pretext

Return Value

$this

$this content(string $content)

Set the content (text) of the attachment.

Parameters

string $content

Return Value

$this

$this fallback(string $fallback)

A plain-text summary of the attachment.

Parameters

string $fallback

Return Value

$this

$this color(string $color)

Set the color of the attachment.

Parameters

string $color

Return Value

$this

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

Add a field to the attachment.

Parameters

Closure|string $title
string $content

Return Value

$this

$this fields(array $fields)

Set the fields of the attachment.

Parameters

array $fields

Return Value

$this

$this markdown(array $fields)

Set the fields containing markdown.

Parameters

array $fields

Return Value

$this

$this image(string $url)

Set the image URL.

Parameters

string $url

Return Value

$this

$this thumb(string $url)

Set the URL to the attachment thumbnail.

Parameters

string $url

Return Value

$this

$this 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

$this

Set the footer content.

Parameters

string $footer

Return Value

$this

$this footerIcon(string $icon)

Set the footer icon.

Parameters

string $icon

Return Value

$this

$this timestamp(DateTimeInterface|DateInterval|int $timestamp)

Set the timestamp.

Parameters

DateTimeInterface|DateInterval|int $timestamp

Return Value

$this