composer require slack-notifier
require __DIR__ . '/vendor/autoload.php';
$client = new Slack\Client('your_team', 'your_token');
$slack = new Slack\Notifier($client);
$message = new Slack\Message\Message('Hello world');
$message->setChannel('#test')
->setIconEmoji(':ghost:')
->setUsername('slack-php');
$slack->notify($message);
require __DIR__ . '/vendor/autoload.php';
$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();
$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);