PHP code example of raph6 / slack-alerts

1. Go to this page and download the library: Download raph6/slack-alerts 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/ */

    

raph6 / slack-alerts example snippets



use raph6\SlackAlerts\SlackAlerts;

// ---

$slack1 = new SlackAlerts('https://hooks.slack.com/services/xxxxxx/yyyyyyy/zzzzzz');
$slack1->setText('test');
$slack1->send();

//  ---

$slack2 = new SlackAlerts([
    'default' => 'https://hooks.slack.com/services/xxxxxx/yyyyyy/zzzzzz',
    'channel2' => 'https://hooks.slack.com/services/yyyyyy/xxxxxx/ssssss'
]);
$slack2->setText('test');
$slack2->send('channel2');