pSlacker is a library for integrating's inbound web hook into your application and sending messages from your app to your Slack chat room
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Build Status Code Climate

pslackr [slak-er]

pSlackr is a library for integrating's inbound web hook into your application enabling you to send messages to your group chat channels from your application


Via Composer

composer require fullybaked/pslackr

### Slack API Token

Pslackr uses the old style of sending the token with the request to Slack, so to find the correct token go to your inbound web hook on Slack and you should see

Where ever Pslackr requires an API token you need to use the last string in the URL aBCDe1FGHijKlmNoP in the example above.

## Usage

Example of basic usage with suplied classes

require_once 'vendor/autoload.php';

use FullyBaked\Pslackr\Messages\CustomMessage;
use FullyBaked\Pslackr\Pslackr;

$message = new CustomMessage('Testing from Pslackr');

$config = ['token' => 'YOUR_TOKEN', 'domain' => 'YOUR_DOMAIN'];
$slack = new Pslackr($config);

Customise the message

The supplied CustomMessage class details the optional parameters that can be sent as part of the request. These parameters allow you to customise the message.

  1. Channel
  2. Username
  3. Icon (url or emoji)

use FullyBaked\Pslackr\Messages\CustomMessage;

$message = new CustomMessage('Testing from Pslackr');



// OR //

Changing the HTTP Client

By default Pslackr was built with Guzzle and has it listed as a dependency, however for various reasons you may wish to use your own HTTP client. If so, this can be acheived by implementing the Transport interface using your own choice of HTTP client.