1. Go to this page and download the library: Download timfeid/slack 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/ */
// Explicitly create a default message
$message = $client->createMessage();
// Set parameters on the message
$message->text = 'This is the text';
$message->icon = ':slack:';
// Or like this
$message['text'] = 'This is the text';
// Or using fluent methods
$message->write('This is the text')->icon(':slack:')->from('username')->to('channel');
// Create a default message from text
$message = $client->write('The text here');
// Create a message with all the parameters you wish to send
$params = [
'username' => 'Tim Feid',
'channel' => '#general',
'text' => 'It\'s happening!',
'icon' => ':poop:',
'attachments' => [
[
'fallback' => 'This is fallback text',
'text' => 'Some text on the attachment',
'image_url' => 'http://placehold.it/320x240',
'fields' => [
'title' => 'Field title',
'value' => 'Field value',
'short' => false,
],
],
],
];
$message = $client->createMessage($params);
// Implicitly
$message = $message->write('This is the text')->to('channel/@username')->from('username')->icon(':slack:');
$message->send();
// Explicitly
$message->to('channel/@username')->from('username')->icon(':slack:')->send('This is the text');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.