Repository URL to install this package:
|
Version:
2.0.1 ▾
|
| scripts |
| src |
| .gitignore |
| .travis.yml |
| README.md |
| composer.json |
A simple Slack Client implementation, which allows async and sync message delivery.
Run composer require crazyfactory/slack to install the latest version into your composer powered project.
The client only requires This class is meant to be instantiated to be used.
// bootstrap your autolaoder require '../vendor/autoload.php'; // instantiate SlackClient $slack = new SlackClient("http://my-slack-webhook.example.com"); // send a message $slack->send("Hello World!");
On construction we can pass in an extended configuration object
// bootstrap your autolaoder require '../vendor/autoload.php'; // instantiate SlackClient $slack = new SlackClient([ "endpoint" => "http://my-slack-webhook.example.com", "context" => [ "username" => "my_bot_name" ] ]);
When sending we can also supply a more complex message context. Have a look at the Slack Incoming Webhooks documentation for this.
// send a message $slack->send([ "text" => "Hello World!", "attachments": [ { "title": "Title", "pretext": "Pretext _supports_ mrkdwn", "text": "Testing *right now!*", "mrkdwn_in": ["text", "pretext"] } ] ]);