PHP code example of mati-core / slack-messenger
1. Go to this page and download the library: Download mati-core/slack-messenger 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/ */
mati-core / slack-messenger example snippets
use \MatiCore\SlackMessenger\SlackMessengerTrait
final class *Presenter extends BasePresenter
{
use SlackMessengerTrait;
}
try{
//Main message object with simple text (primary show on notification banner)
$message = new Message('Hello World!');
//You can set message title
$message->setTitle(':star: Hello World!');
// Add markdown section with formated text
$message->addSection(new MarkdownSection(
'This is my *FIRST* message from website!'
));
// Add divider
$message->addSection(new Divider());
// Add link
$message->addSection(new MarkdownSection('Odesláno z kontaktního formuláře na app-universe.cz | '. date('d.m.Y H:i:s')));
// send message
$this->slackMessenger->sendMessage($message);
}catch (\MatiCore\SlackMessenger\SlackMessengerException $e){
// Send message error
}