1. Go to this page and download the library: Download polem/slack-notifier library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
polem / slack-notifier example snippets
$client = new Slack\Client('your_team', 'your_token');
$slack = new Slack\Notifier($client);
$message = new Slack\Message\Message('Hello world');
$message->setChannel('#test')
->setMrkdwn(true)
->setIconEmoji(':ghost:')
->setUsername('slack-php');
$slack->notify($message);
$client = new Slack\Client('your_team', 'your_token');
$slack = new Slack\Notifier($client);
$message = new Slack\Message\Message('Hello world');
$attachment = new Slack\Message\MessageAttachment();
$attachment
->setMrkdwnIn(array('pretext', 'text', 'fields'))
->setFallback('fallback text')
->setPretext('Pretext text')
->setAuthorName('Author Name')
->setAuthorLink('Author Link')
->setAuthorIcon('Author Icon')
->setTitle('Title')
->setTitleLink('http://github.com')
->setImageUrl('http://github.com/image.jpg');
$field = new Slack\Message\MessageField();
$field
->setTitle('foo')
->setValue('bar');
$attachment->addField($field);
$message->addAttachment($attachment);
$message->setChannel('#test')
->setIconEmoji(':ghost:')
->setUsername('slack-php');
$slack->notify($message);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.