PHP code example of vallbo / slack-incoming-web-hooks

1. Go to this page and download the library: Download vallbo/slack-incoming-web-hooks 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/ */

    

vallbo / slack-incoming-web-hooks example snippets


use Vallbo\SlackNotification\Adapter\GuzzleConnector;
use Vallbo\SlackNotification\NotificationFactory\NotificationMessageFactory;


$factory = new NotificationMessageFactory(
    '<hook URI>'
);

$message = $factory->createNotificationMessage('TEST', 'fun');

$connector = new GuzzleConnector(new \GuzzleHttp\Client());

$connector->sendNotification($message);