manavo / chatty
Installs: 3 892
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- guzzlehttp/guzzle: ~4.0|~5.0|~6.0
Requires (Dev)
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: 2.0.*@dev
This package is not auto-updated.
Last update: 2022-02-01 12:41:26 UTC
README
A library to send messages to different group chat services (Slack, HipChat).
It can easily be used to send notifications about what's happening in your app (user signed up, etc)
Authors
Installation
Install via Composer
composer require manavo/chatty
Services
Supported services at the moment are:
- Slack
- HipChat
Usage
Slack
$slackUrl = 'https://my.slack.com/services/hooks/incoming-webhook?token=XXXXXXXXXX'; $slackParams = array( 'url' => $slackUrl, 'username' => 'Chatty', 'icon' => 'https://www.crystalvaults.com/images/bagua-square.gif', ); $chatty = new \Manavo\Chatty\Sender(new \Manavo\Chatty\MessageHandlers\Slack($slackParams)); $chatty->send($message);
HipChat
$hipchatParams = array( 'token' => '123456789123456789', 'room_id' => 'Notifications', 'from' => 'Chatty', 'color' => 'random', 'notify' => 0, ); $chatty = new \Manavo\Chatty\Sender(new \Manavo\Chatty\MessageHandlers\Hipchat($hipchatParams)); $chatty->send($message);
Custom handler
class MyHandler implements \Manavo\Chatty\Interfaces\MessageHandlerInterface { public function handle($message) { echo $message.PHP_EOL; } } $chatty = new \Manavo\Chatty\Sender(new MyHandler()); $chatty->send($message);