PHP 클래스 Maknz\Slack\Client

파일 보기 프로젝트 열기: maknz/slack 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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