PHP Класс Maknz\Slack\Client

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allow_markdown boolean Whether message text should be formatted with Slack's Markdown-like language.
$channel string The default channel to send messages to.
$endpoint string The Slack incoming webhook endpoint.
$guzzle GuzzleHttp\Client The Guzzle HTTP client instance.
$icon string The default icon to send messages with.
$link_names boolean Whether to link names like @regan or leave them as plain text.
$markdown_in_attachments array The attachment fields which should be formatted with Slack's Markdown-like language.
$unfurl_links boolean Whether Slack should unfurl text-based URLs.
$unfurl_media boolean Whether Slack should unfurl media URLs.
$username string The default username to send messages as.

Открытые методы

Метод Описание
__call ( string $name, array $arguments ) : Message Pass any unhandled methods through to a new Message instance.
__construct ( string $endpoint, array $attributes = [], Client $guzzle = null ) : void Instantiate a new Client.
createMessage ( ) : Message Create a new message with defaults.
getAllowMarkdown ( ) : boolean Get whether message text should be formatted with Slack's Markdown-like language.
getDefaultChannel ( ) : string Get the default channel messages will be created for.
getDefaultIcon ( ) : string Get the default icon messages will be created with.
getDefaultUsername ( ) : string Get the default username messages will be created for.
getEndpoint ( ) : string Get the Slack endpoint.
getLinkNames ( ) : boolean Get whether messages sent will have names (like @regan) will be converted into links.
getMarkdownInAttachments ( ) : array Get the attachment fields which should be formatted in Slack's Markdown-like language.
getUnfurlLinks ( ) : boolean Get whether text links should be unfurled.
getUnfurlMedia ( ) : boolean Get whether media links should be unfurled.
preparePayload ( Message $message ) : array Prepares the payload to be sent to the webhook.
sendMessage ( Message $message ) : void Send a message.
setAllowMarkdown ( boolean $value ) : void Set whether message text should be formatted with Slack's Markdown-like language.
setDefaultChannel ( string $channel ) : void Set the default channel messages will be created for.
setDefaultIcon ( string $icon ) : void Set the default icon messages will be created with.
setDefaultUsername ( string $username ) : void Set the default username messages will be created for.
setEndpoint ( string $endpoint ) : void Set the Slack endpoint.
setLinkNames ( boolean $value ) : void Set whether messages sent will have names (like @regan) will be converted into links.
setMarkdownInAttachments ( array $fields ) : void Set the attachment fields which should be formatted in Slack's Markdown-like language.
setUnfurlLinks ( boolean $value ) : void Set whether text links should be unfurled.
setUnfurlMedia ( boolean $value ) : void Set whether media links should be unfurled.

Защищенные методы

Метод Описание
getAttachmentsAsArrays ( Message $message ) : array Get the attachments in array form.

Описание методов

__call() публичный Метод

Pass any unhandled methods through to a new Message instance.
public __call ( string $name, array $arguments ) : Message
$name string The name of the method
$arguments array The method arguments
Результат Message

__construct() публичный Метод

Instantiate a new Client.
public __construct ( string $endpoint, array $attributes = [], Client $guzzle = null ) : void
$endpoint string
$attributes array
$guzzle GuzzleHttp\Client
Результат void

createMessage() публичный Метод

Create a new message with defaults.
public createMessage ( ) : Message
Результат Message

getAllowMarkdown() публичный Метод

Get whether message text should be formatted with Slack's Markdown-like language.
public getAllowMarkdown ( ) : boolean
Результат boolean

getAttachmentsAsArrays() защищенный Метод

Get the attachments in array form.
protected getAttachmentsAsArrays ( Message $message ) : array
$message Message
Результат array

getDefaultChannel() публичный Метод

Get the default channel messages will be created for.
public getDefaultChannel ( ) : string
Результат string

getDefaultIcon() публичный Метод

Get the default icon messages will be created with.
public getDefaultIcon ( ) : string
Результат string

getDefaultUsername() публичный Метод

Get the default username messages will be created for.
public getDefaultUsername ( ) : string
Результат string

getEndpoint() публичный Метод

Get the Slack endpoint.
public getEndpoint ( ) : string
Результат string

getLinkNames() публичный Метод

Get whether messages sent will have names (like @regan) will be converted into links.
public getLinkNames ( ) : boolean
Результат boolean

getMarkdownInAttachments() публичный Метод

Get the attachment fields which should be formatted in Slack's Markdown-like language.
public getMarkdownInAttachments ( ) : array
Результат array

getUnfurlMedia() публичный Метод

Get whether media links should be unfurled.
public getUnfurlMedia ( ) : boolean
Результат boolean

preparePayload() публичный Метод

Prepares the payload to be sent to the webhook.
public preparePayload ( Message $message ) : array
$message Message The message to send
Результат array

sendMessage() публичный Метод

Send a message.
public sendMessage ( Message $message ) : void
$message Message
Результат void

setAllowMarkdown() публичный Метод

Set whether message text should be formatted with Slack's Markdown-like language.
public setAllowMarkdown ( boolean $value ) : void
$value boolean
Результат void

setDefaultChannel() публичный Метод

Set the default channel messages will be created for.
public setDefaultChannel ( string $channel ) : void
$channel string
Результат void

setDefaultIcon() публичный Метод

Set the default icon messages will be created with.
public setDefaultIcon ( string $icon ) : void
$icon string
Результат void

setDefaultUsername() публичный Метод

Set the default username messages will be created for.
public setDefaultUsername ( string $username ) : void
$username string
Результат void

setEndpoint() публичный Метод

Set the Slack endpoint.
public setEndpoint ( string $endpoint ) : void
$endpoint string
Результат void

setLinkNames() публичный Метод

Set whether messages sent will have names (like @regan) will be converted into links.
public setLinkNames ( boolean $value ) : void
$value boolean
Результат void

setMarkdownInAttachments() публичный Метод

Set the attachment fields which should be formatted in Slack's Markdown-like language.
public setMarkdownInAttachments ( array $fields ) : void
$fields array
Результат void

setUnfurlMedia() публичный Метод

Set whether media links should be unfurled.
public setUnfurlMedia ( boolean $value ) : void
$value boolean
Результат void

Описание свойств

$allow_markdown защищенное свойство

Whether message text should be formatted with Slack's Markdown-like language.
protected bool $allow_markdown
Результат boolean

$channel защищенное свойство

The default channel to send messages to.
protected string $channel
Результат string

$endpoint защищенное свойство

The Slack incoming webhook endpoint.
protected string $endpoint
Результат string

$guzzle защищенное свойство

The Guzzle HTTP client instance.
protected Client,GuzzleHttp $guzzle
Результат GuzzleHttp\Client

$icon защищенное свойство

The default icon to send messages with.
protected string $icon
Результат string

$markdown_in_attachments защищенное свойство

The attachment fields which should be formatted with Slack's Markdown-like language.
protected array $markdown_in_attachments
Результат array

$unfurl_media защищенное свойство

Whether Slack should unfurl media URLs.
protected bool $unfurl_media
Результат boolean

$username защищенное свойство

The default username to send messages as.
protected string $username
Результат string