PHP code example of raffmartinez / php-slack-wrapper

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

    

raffmartinez / php-slack-wrapper example snippets


$legacyApiKey = 'xoxp-123456789-1234567890';
$slack = new \RaffMartinez\Slack\Slack($legacyApiKey);

$channelList = $slack->getChannelList();

$slack->postMessage($channelList[0], \RaffMartinez\Slack\Message::simpleMessage('Hello', 'MyBot'));
$ts = $slack->getLastMessageTs();

$slack->postMessage($channelList[0], \RaffMartinez\Slack\Message::responseMessage('Hello', 'MyBot', $ts));

$allUsers = $slack->getUserList();