PHP code example of arthurkushman / slacky
1. Go to this page and download the library: Download arthurkushman/slacky 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/ */
arthurkushman / slacky example snippets
use Slacky\Http\SlackResponseFactory;
use Slacky\Http\CurlInteractor;
use Slacky\Core\Commander;
$interactor = new CurlInteractor;
$interactor->setResponseFactory(new SlackResponseFactory);
$commander = new Commander('xoxp-some-token-for-slack', $interactor);
$response = $commander->execute('chat.postMessage', [
'channel' => '#general',
'text' => 'Hello, world!'
]);
if ($response['ok'])
{
// Command worked
}
else
{
// Command didn't work
}