PHP code example of carpediem / mattermost-webhook

1. Go to this page and download the library: Download carpediem/mattermost-webhook 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/ */

    

carpediem / mattermost-webhook example snippets




uzzleHttp\Client as GuzzleClient;
use Carpediem\Mattermost\Webhook\Client;
use Carpediem\Mattermost\Webhook\Message;

$mattermost = new Client(new GuzzleClient());
$message = new Message('This is a *test*.');
$response = $mattermost->notify('https://your_mattermost_webhook_url', $message);

//$response is a Psr7\Http\Message\ResponseInterface.